当前位置: 代码迷 >> Android >> Android除开TitleBar的方法
  详细解决方案

Android除开TitleBar的方法

热度:44   发布时间:2016-04-28 04:14:26.0
Android去掉TitleBar的方法

原文请点击这里

第一种,在调用setContentView()之前插入代码:

requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏setContentView(R.layout.activity_main);

?第二种,在AndroidManifest.xml文件中配置Activity:

?

<activity    android:name="com.example.MainActivity"    android:label="@string/app_name"    android:theme="@android:style/Theme.NoTitleBar" >    <intent-filter>        <action android:name="android.intent.action.MAIN" />        <category android:name="android.intent.category.LAUNCHER" />    </intent-filter></activity>

?

第三种,修改res/value/style.xml文件,增加一个样式,然后在相应的activity中应用该样式:

?

<!-- Application theme. --><style name="AppTheme" parent="AppBaseTheme"><item name="android:windowNoTitle">true</item></style>

?定义完了一个style,接下来就是在AndroidManifest.xml中使用了:

<application    android:icon="@drawable/icon"    android:label="@string/app_name"    android:theme="@style/AppTheme">

?

?

?
  相关解决方案