android actionbar - How to set App title at center in Navigation drawer Action Bar? -


i want customize navigation drawer app compact action bar, want remove app icon , want make title center in action bar.

i have applied solutions , nothing working conditions.

please give me clue applying.

in simple activity can create custom action bar , how create customize navigation drawer action bar

please share idea's .....

to archive having centered title in abs (if want have in default actionbar, remove "support" in method names), this:

in activity, in oncreate() method:

getsupportactionbar().setdisplayoptions(actionbar.display_show_custom);  getsupportactionbar().setcustomview(r.layout.abs_layout); 

abs_layout:

<?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:orientation="vertical" >      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center"         android:text="my title"         android:textcolor="#ffffff"         android:id="@+id/mytext"         android:textsize="18sp" />  </linearlayout> 

now should have actionbar title. if want set custom background, set in layout above (but don't forget set android:layout_height="match_parent").

or with:

getsupportactionbar().setbackgrounddrawable(getresources().getdrawable(r.drawable.yourimage) 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -