去掉Android新建项目的顶部标题-application:Theme

来源:互联网 发布:2016年就业数据 编辑:程序博客网 时间:2024/06/05 03:38

说明:

AndroidStudio新建项目会有默认的主题,默认主题是带等不标题的,项目中用不到,这时候就需要修改application的Theme了。

application的Theme起到全局作用:定义工具栏颜色等。

图片:

原图:

修改后图:


代码:只用修改styles中的代码即可。

原AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?><manifest package="mandao.component"          xmlns:android="http://schemas.android.com/apk/res/android">    <application        android:allowBackup="true"        android:icon="@mipmap/ic_launcher"        android:label="@string/app_name"        android:supportsRtl="true"        android:theme="@style/AppTheme">        <activity android:name=".MainActivity">            <intent-filter>                <action android:name="android.intent.action.MAIN"/>                <category android:name="android.intent.category.LAUNCHER"/>            </intent-filter>        </activity>    </application></manifest>
原Styles.xml

<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">        <!-- Customize your theme here. -->        <item name="colorPrimary">@color/colorPrimary</item>        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>        <item name="colorAccent">@color/colorAccent</item>    </style></resources>

修改后Styles.xml:

<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">        <!-- Customize your theme here. -->        <item name="colorPrimary">@color/colorPrimary</item>        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>        <item name="colorAccent">@color/colorAccent</item>    </style></resources>



1 0
原创粉丝点击