【发布时间】:2015-07-29 06:57:52
【问题描述】:
我有这么具体的问题。我正在为所有文本视图应用主题。它出现在预览中,但是当我在手机上运行这个应用程序时,我面对的是无样式的文本视图。我为其他视图设置的样式正在起作用。只有 textviewstyle 不起作用。
在此示例文本视图中,预览颜色为绿色,但当我在手机上运行它时,它是黑色的。为什么?
style.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textViewStyle">@style/myTextViewStyle</item>
<item name="android:buttonStyle">@style/myButtonStyle</item>
<item name="android:editTextStyle">@style/myEditTextStyle</item>
<!-- Customize your theme here. -->
</style>
<style name="myTextViewStyle" parent="@android:style/Widget.TextView">
<item name="android:textColor">#00ff00</item>
<item name="android:textSize">24sp</item>
</style>
<style name="myButtonStyle" parent="@android:style/Widget.Button">
<item name="android:textColor">#00ff00</item>
<item name="android:textSize">24sp</item>
</style>
<style name="myEditTextStyle" parent="@android:style/Widget.EditText">
<item name="android:textColor">#00ff00</item>
<item name="android:textSize">24sp</item>
</style>
activity_main.xml
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="button" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="edit text" />
【问题讨论】:
标签: android xml textview styles android-theme