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

Popular posts from this blog

c++ - Function signature as a function template parameter -

How to call a javascript function after the page loads with a chrome extension? -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -