Tôi cố gắng để áp dụng một màu nút văn bản theo mặc định trong styles.xmlphong cách Android chỉ định nút màu
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme">
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">@color/black</item>
<item name="android:textColor">@color/green</item>
</style>
Làm thế nào để làm cho các nút thay đổi màu sắc theo phong cách, và áp dụng trong suốt toàn bộ ứng dụng? My mainfest bao gồm:
<application
android:icon="@drawable/ic_launcher"
android:label="Hack the World"
android:theme="@style/AppTheme">
Điều này thay đổi tất cả văn bản (như TextView), nhưng không thay đổi văn bản trong một nút. Nếu tôi sử dụng kiểu ColorThemes từ trên cao và đặt nó vào xml cho nút như sau:
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:onClick="loadSavedgame"
android:text="Load Saved Game"
android:textColor="@color/green" />"
Sau đó, nó hoạt động hoàn hảo. Tại sao điều này không áp dụng phổ biến vì phong cách? Tất cả các phiên bản khác nhau của styles.xml có cùng mã.