在Mainifest里面设置属性
<application
android:name="com.stu.ui.MainApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.stu.ui.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:windowSoftInputMode="stateAlwaysHidden" >
此时,程序标题栏被去掉
开启程序时没有标题栏
但是,如果你需要让程序的标题栏在程序正式开启以后显示,那么,你需要按照下面的方法,在
onCreate()里面添加代码:
@Override
public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.AppTheme);//自定义标题栏,还是使用系统的!
super.onCreate(savedInstanceState);
添加语句 setTheme(R.style.AppTheme)
当然,你也可以添加系统Theme,
setTheme(android.R.style.Theme)