代码实现:protected void onCreate(Bundle savedInstanceState)里添加(这个要加在setContentView(R.layout.activity_main);之前一栏否则报错)
getSupportActionBar().hide(); //if (getSupportActionBar() != null){ // getSupportActionBar().hide(); //}或者
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);xml实现: 在res/values 目录创建个theme.xml文件(用来放样式)
<!-- name 是Style的名称,parent 继承那个父类样式 --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">或者改里面的item:
<style name="theme_NoTitle" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="windowNoTitle">true</item> </style>然后使用 改AndroidMainfest.xml
<activity android:name=".login.LoginActivity" android:theme="@style/theme_fullScreen"/>代码实现:protected void onCreate(Bundle savedInstanceState)里添加
requestWindowFeature(Window.FEATURE_NO_TITLE);styles.xml 同理建议单独使用Theme.xml
<activity android:name=".Activity" android:theme="@android:style/Theme.NoTitleBar"> </activity>protected void onCreate(Bundle savedInstanceState)里添加(这个要加在setContentView(R.layout.activity_main);之前一栏否则报错)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);.xml实现: 同理,建议单独建立theme.xml
//两个都去除,应该单独也能用,需要继承Activity // parent="@android:style/Theme.NoTitleBar.Fullscreen <item name="android:windowFullscreen">?android:windowNoTitle</item> <!-- 是否填充慢屏幕,引用android:windowNoTitle 的值 ?android:windowNoTitle,取决于android:windowNoTitle的值-->修改AndroidMainfest.xml
<action android:name="android.intent.action.MAIN" //重点是这个,哪个要去,设哪个里面 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>不推荐直接在styles.xml里修改,因为那个是整个应用修改