How to align title at center of ActionBar in default theme(Theme.Holo.Light)

You can create a custom layout and apply it to the actionBar. To do so, follow those 2 simple steps: Java Code getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getSupportActionBar().setCustomView(R.layout.actionbar); Where R.layout.actionbar is the following layout. XML <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_gravity=”center” android:orientation=”vertical”> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center” android:id=”@+id/action_bar_title” android:text=”YOUR ACTIVITY TITLE” android:textColor=”#ffffff” android:textSize=”24sp” /> </LinearLayout> It can be … Read more

Align text baseline with a button in CSS

You can use: line-height! .box { color: #fff; background: #444; height: 40px; line-height: 40px; /* Same as height */ } <p class=”box”>some text <input type=”button” value=”Button” /></p> set for the button parent, where, as you can see, line-height matches the element height and will align both texts at the element’s (p) center. Otherwise, the button, … Read more

How can I align text in columns using Console.WriteLine?

Try this Console.WriteLine(“{0,10}{1,10}{2,10}{3,10}{4,10}”, customer[DisplayPos], sales_figures[DisplayPos], fee_payable[DisplayPos], seventy_percent_value, thirty_percent_value); where the first number inside the curly brackets is the index and the second is the alignment. The sign of the second number indicates if the string should be left or right aligned. Use negative numbers for left alignment. Or look at http://msdn.microsoft.com/en-us/library/aa331875(v=vs.71).aspx

How to align an object in SVG document?

I was looking for a way to float a < g> element to the right of a svg file with width=100%. So one could scale the image and my < g> element would stick to the right without beeing scaled. Here is what I found out: <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1//EN” … Read more

How to align UILabel text from bottom?

Swift 4.2 version using the contentMode property to set top and bottom: class VerticalAlignedLabel: UILabel { override func drawText(in rect: CGRect) { var newRect = rect switch contentMode { case .top: newRect.size.height = sizeThatFits(rect.size).height case .bottom: let height = sizeThatFits(rect.size).height newRect.origin.y += rect.size.height – height newRect.size.height = height default: () } super.drawText(in: newRect) } } … Read more

Center an auto-width div?

for parent block or body – text-align:center; for centerd block- display:inline-block; .center { display: inline-block; background: red; } body { text-align: center; } <div class=”center”> <p contenteditable=”true”> write text </p> </div> DEMO http://jsfiddle.net/RXP4F/ Content Editable MDN

Center an tag inside a

You can add line-height:51px to #AlertDiv h1 if you know it’s only ever going to be one line. Also add text-align:center to #AlertDiv. #AlertDiv { top:198px; left:365px; width:62px; height:51px; color:white; position:absolute; text-align:center; background-color:black; } #AlertDiv h1 { margin:auto; line-height:51px; vertical-align:middle; } The demo below also uses negative margins to keep the #AlertDiv centered on both … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)