android-studio - Android Studio-Designer 不显示颜色作为模拟器/手机
问题描述
模拟器(和设备)上的字符串下划线为绿色,但在设计器窗口上为灰色。style 和 colors.xml 中没有自定义颜色。那么为什么颜色不一样呢?
清单.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>
颜色.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>
样式.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:抱歉链接上的图片 - 我没有足够的声誉直接发布图片。
解决方案
嗯......它在设计器窗口中是灰色的,因为它在那里没有活动(显然)并且它在模拟器中是青色的,因为它是 Android 的默认强调色。尝试更改colorAccent
值以将默认颜色更改为其他颜色
推荐阅读
- rust - Rust 中的发送/接收范式
- javascript - 如何在Vue中使用不同文件中的函数
- typescript - 打字稿:两个实例之间的选择性属性复制会产生编译错误
- angular - 使用平面图并使用 Angular 8 和 Guard 进行点击
- python-3.x - 如何读取浮点数的特定位位置?
- javascript - 文本装饰过渡未显示
- sql - 使用 BigQuery 选择 INTO
- laravel - 当前 URL 未在 Laravel 中打印
- swift - UITableview 将单元格移动到错误的部分并用空白替换其先前的位置
- java - 我在尝试编译我的披萨订单程序时遇到错误消息