Activity 的窗口去头的方式

本文介绍了三种去除Android应用窗口头部的方法:通过代码设置、在清单文件中配置以及修改默认主题样式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1\窗口去头的第一种方式

public class SplashActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);//窗口去头的第一种方式,必须在下句前面
setContentView(R.layout.activity_splash);
}

}

 

2\第2种,清单文件中修改  android:theme="@android:style/Theme.Light.NoTitleBar" >   

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar" >   
<activity
android:name="com.phonesalf.SplashActivity.SplashActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

3\修改默认的android:theme="@style/AppTheme" >里面的内容:

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:windowNoTitle">true</item>
</style>

转载于:https://www.cnblogs.com/15157737693zsp/p/9219588.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值