android - hide activity name from action bar just in time of creation -
just in time of creation , 1 second or less action bar shows name of activity declared in manifest. there way avoid this? of course when activity created change programmatically title.the manifest:
<activity android:name="com.abc.homeactivity" android:screenorientation="portrait" android:label="home" android:icon="@drawable/x_logo"> </activity>
and code fragment shown activity. change title of action bar based on fragment shown.
((actionbaractivity) getactivity()).getsupportactionbar().settitle("variable name");
from activity:
super.oncreate(savedinstancestate); getsupportactionbar().settitle("");
if hiding activity name means avoiding text, call following in oncreate of activity
:
getactionbar().settitle(null); //if using actionbar theme settitle(null); //if using standard theme
update
@override protected void oncreate(bundle savedinstancestate) { ... final charsequence title = getactionbar().gettitle(); getactionbar().settitle(null); //sets title again after 1 second delay new handler().postdelayed(new runnable() { @override public void run() { getactionbar().settitle(title); } }, 1000); }
Comments
Post a Comment