Android Studio-Designer 未将颜色显示为 emulator/phone
Android Studio-Designer does not show Colors as the emulator/phone
模拟器(和设备)上的字符串下划线是绿色的,但在设计器 window 上是灰色的。样式和 colors.xml 中没有自定义颜色。那么为什么颜色不同?
manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp">
<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/AppTheme">
<activity android:name="com.example.myfirstapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.myfirstapp.DisplayMessageActivity"
android:parentActivityName="com.example.myfirstapp.MainActivity">
<!--The meta-data tag is required if you support API level 15 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity"/>
</activity>
</application>
</manifest>
colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--<color name="colorPrimary">#087609</color>
<color name="colorPrimaryDark">#002900</color>
<color name="colorAccent">#327f4f</color>-->
</resources>
styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<!--<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
-->
</style>
</resources>
PS:抱歉链接上的图片 - 我没有足够的声誉直接 post 图片。
好吧...它在设计器 window 中是灰色的,因为它在那里没有激活(很明显),它在模拟器中是蓝绿色的,因为它是 Android 的默认强调色。尝试更改 colorAccent
值以将默认颜色更改为其他颜色
模拟器(和设备)上的字符串下划线是绿色的,但在设计器 window 上是灰色的。样式和 colors.xml 中没有自定义颜色。那么为什么颜色不同?
manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp">
<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/AppTheme">
<activity android:name="com.example.myfirstapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.myfirstapp.DisplayMessageActivity"
android:parentActivityName="com.example.myfirstapp.MainActivity">
<!--The meta-data tag is required if you support API level 15 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity"/>
</activity>
</application>
</manifest>
colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--<color name="colorPrimary">#087609</color>
<color name="colorPrimaryDark">#002900</color>
<color name="colorAccent">#327f4f</color>-->
</resources>
styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<!--<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
-->
</style>
</resources>
PS:抱歉链接上的图片 - 我没有足够的声誉直接 post 图片。
好吧...它在设计器 window 中是灰色的,因为它在那里没有激活(很明显),它在模拟器中是蓝绿色的,因为它是 Android 的默认强调色。尝试更改 colorAccent
值以将默认颜色更改为其他颜色