java - custom actionbar title in android -
hey guys want in setting current activity title in custom actionbar.
my on create function:
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final actionbar actionbar = getactionbar(); actionbar.setcustomview(r.layout.actionbar_custom_view_home); actionbar.setdisplayshowtitleenabled(false); //i guess line below wrong actionbar.settitle(this.gettitle()); actionbar.setdisplayshowcustomenabled(true); actionbar.setdisplayuselogoenabled(false); actionbar.setdisplayshowhomeenabled(false); }
actionbar_custom_view_home.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" > <imageview android:id="@+id/imageicon" android:onclick="click" android:layout_width="wrap_content" android:layout_height="match_parent" android:src="@drawable/logo" /> <textview android:id="@+id/title" android:layout_width="match_parent" android:layout_height="wrap_content" android:textcolor="#fff" android:textsize="25sp" /> </linearlayout>
Comments
Post a Comment