Activity 的窗口去头的方式

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>

posted @ 2018-06-24 08:40  紫旭  阅读(139)  评论(0编辑  收藏  举报