Android Activity Call Requestwindowfeature First And Show The Title
My Activitys use a theme which set android:windowNoTitle = true.But I have to show the title in some activities. I want show the title in my activity by call requestWindowFeature()
Solution 1:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.yourlayout);
You don't need to apply any Theme if you use this.
Solution 2:
you have to use this method before your setContentView method...
requestWindowFeature(Window.FEATURE_NO_TITLE);
OR
And yes you can add theme in Manifest file in which Activity you don't want to Title..Then use this..
<activityandroid:name=".activity name"android:theme="@android:style/Theme.Black.NoTitleBar"android:screenOrientation="potrait" ></activity>
first change this:
if (mThemeId != -1) {
this.setTheme(mThemeId);
}
and after that you can use
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
Solution 3:
<activityandroid:name=".HistoryImage"android:screenOrientation="sensorPortait"android:theme="@android:style/Theme.Black.NoTitleBar" ></activity><activityandroid:name=".HistoryVideo"android:screenOrientation="sensorPortait" ></activity><activityandroid:name=".HistoryVideo_2"android:theme="@android:style/Theme.Black.NoTitleBar"android:screenOrientation="sensorPortait" ></activity>
Solution 4:
you must call requestWindowFeature(); before setContentView()
Solution 5:
The activities in which you don't want to show the title bar. just do this to hide the title bar. befor setcontentView requestWindowFeature(Window.FEATURE_NO_TITLE);
Post a Comment for "Android Activity Call Requestwindowfeature First And Show The Title"