2016-10-28 71 views
0

工作,我有一个activity_login.xmlAndroid Studio一个FrameLayout,不以全屏模式使用此配置出现:全屏布局不会在Android

AndroidManifest.xml

<activity 
    android:name=".Activities.LoginActivity" 
    android:label="@string/title_activity_login" 
    android:launchMode="singleTop" 
    android:theme="@style/LoginScreenTheme.TranslucentBar" > 
</activity> 

Styles.xml:

<style name="LoginScreenTheme.TranslucentBar" parent="Theme.AppCompat.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    <item name="android:windowTranslucentStatus">true</item> 
    <item name="android:windowTranslucentNavigation">true</item> 
</style> 

Toolbar仍然出现在Layout

+0

Change to Theme.AppCompat.Light.NoActionBar – MichaelStoddart

+0

http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing -custom主题 –

回答

0

我什么都不做,今天当我开始我的项目,活动是全屏。谢谢你们!

0

看看您的活动布局,很可能有AndroidStudio为您生成的工具栏视图。如果不起作用添加到样式:

<item name="android:windowFullscreen">true</item> 
0

修改onCreateView(),如下

@Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 

     requestWindowFeature(Window.FEATURE_NO_TITLE); 
     this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    } 
0

为了删除工具栏/动作条,你不需要做什么特别的。只需将所有内容保留为默认值并转至styles.xml并将AppTheme更改为Theme.AppCompat.Light.NoActionBar,并确保您的活动扩展了AppCompactActivity。它总是为我工作。希望它能帮助你。如果你还想删除StatusBar然后按照上面的@EKN解决方案;)