![](/img/trans.png)
[英]How to set backGround color Black and text white in android webview
[英]white background and black text color on android wear app
在我的Android服裝應用程序中,我需要將默認的黑色背景更改為白色,將文本顏色更改為黑色。 為了在每次創建新的布局文件時都不設置這些顏色,我創建了一個定義背景和文本顏色的主題並將其應用到主布局文件
布局文件:
<?xml version="1.0" encoding="utf-8"?>
<android.support.wearable.view.WatchViewStub
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/watch_view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:roundLayout="@layout/round_activity_wear"
app:rectLayout="@layout/rect_activity_wear"
tools:context="com.example.wear.WearActivity"
tools:deviceIds="wear"
style="@style/AppTheme">
</android.support.wearable.view.WatchViewStub>
樣式文件:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="android:background">#FFFFFF</item>
<item name="android:text">#000000</item>
<item name="android:color">#000000</item>
<item name="android:colorForeground">#000000</item>
<item name="android:textColor">#000000</item>
<item name="android:textColorPrimary">#000000</item>
<item name="android:textColorSecondary">#000000</item>
<item name="android:textAppearance">@style/WearTextAppearance</item>
</style>
<style name="WearTextAppearance" parent="@android:style/TextAppearance.Medium">
<item name="android:color">#000000</item>
<item name="android:colorForeground">#000000</item>
</style>
</resources>
我附上后,背景變為白色,但文字顏色仍為白色。 我做錯了什么? 為什么我的文字顏色不像我期望的那樣黑?
我在清單的應用程序標簽中設置主題后,它工作了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.