android - Actionbar title not coming up in center? -


i want center title in actionbar. have created custom layout comes in center if home icon visible if set false title shifts left not coming in center.

the actionbar should have title , menu options , no home icon take user previous screen. have tried giving left margin still doesn't work.

is there workaround this??

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >  <textview     android:id="@+id/txttitle"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerinparent="true"     android:ellipsize="end"     android:maxlines="1"     android:text="@string/app_name"     android:textappearance="?android:attr/textappearancemedium"     android:textcolor="@android:color/white"     android:textsize="@dimen/title_size" />  </relativelayout> 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -