机器人:主题=" @android:款式/ Theme.NoTitleBar.Fullscreen"工作在应用层而不是在活动水平。任何线索?
我需要让我的活动称为MyNoStatusBarActivity.java一个全屏幕的活动之一。
I need to make one of my activities called MyNoStatusBarActivity.java a full screen activity.
我加在清单:
<activity
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:name=".MyNoStatusBarActivity"
android:noHistory="true"
android:label="@string/app_name"
android:configChanges="touchscreen|keyboard|keyboardHidden|navigation|orientation">
...
</activity>
这是在我的活动的onCreate:
an in the onCreate of my activity :
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
做这一切只是隐藏标题栏,而不是状态栏。
Doing all this just hides the TITLE bar and not the STATUS bar.
另外,如果我用清单主题在应用层,而不是我的活动,它的工作原理,但我的应用程序的这是不是我想要的一切活动。我只想要一个特别的活动没有状态栏。
Also if I use the manifest theme on the application level instead of my activity, it works but for all activities of my app which is not what I want. I want the no status bar only for one particular activity.
帮助将是非常美联社preciated。日Thnx!
Help will be really appreciated. Thnx!
PS:我确定是这种行为不再蜂窝/ ICS可用。我需要这只是2.2和2.3
P.S : I am ok is this behavior is no longer available in Honeycomb/ICS. I need this just for 2.2 and 2.3
修改 尝试了所有中提到的其他解决方案,因此,但没有成功,但建议。当施加到应用水平,但不能在活动水平主题的工作原理。
EDIT Tried all the suggestions mentioned in other solutions in SO but no success yet. Theme works when applied to the application level but not on the activity level.
我使用的HTC野火S,安卓2.3.5版本
I am using HTC WildFire-S, android ver 2.3.5
在你的清单XML,在应用层面把这样的:
In your manifest xml, at application level put this:
<application
...
android:theme="@android:style/Theme.NoTitleBar" >
</application>
和在你想全屏把这个活动:
and in the activity that you want to make full screen put this:
<activity
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
...
</activity>
删除所有setWindowsFeature或setFlag方法的onCreate。
Remove all the setWindowsFeature or setFlag methods in onCreate.