提问人:Amirhussein 提问时间:3/14/2023 更新时间:3/14/2023 访问量:22
更改主题 .xml 中的主题颜色项不会更改应用中的任何内容
Changing Theme colors items in themes.xml dosn't change anything in the app
问:
我想自定义我的应用程序主题。我更改了 AND 和其他属性,但没有一个属性在应用程序中进行了任何更改。colorPrimary
colorPrimaryDark
清单.XML :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.miplan">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage">
</uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MaterialComponents.DayNight">
<activity
android:name=".SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".LogoActivity"
android:exported="true">
</activity>
</application>
</manifest>
主题.XML :
<resources>
<!-- Base application theme. -->
<style name="Theme.MiPlan" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">#458077</item>
<item name="colorPrimaryDark">#620051</item>
<item name="android:textColorPrimary">#FD1CC1</item>
<item name="android:windowBackground">#FFFF</item>
<item name="android:navigationBarColor">#FF25</item>
</style>
</resources>
我通常如何才能擅长使用主题和风格?
答:
0赞
Nrohpos
3/14/2023
#1
通过此方式使用您创建的主题
android:theme="@style/Theme.MiPlan"
评论
android:theme="@style/Theme.MaterialComponents.DayNight">
Theme.MiPlan