Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 将buttonStyle应用为主题不会';不起作用,但如果直接应用于按钮,则不起作用_Android_Android Styles - Fatal编程技术网

Android 将buttonStyle应用为主题不会';不起作用,但如果直接应用于按钮,则不起作用

Android 将buttonStyle应用为主题不会';不起作用,但如果直接应用于按钮,则不起作用,android,android-styles,Android,Android Styles,我在看一本关于这个问题的教程。如果我直接将样式应用于按钮,它会工作,但是如果我使用android:buttonStyle将样式应用于主题,它不会工作 示例-以下是应用按钮样式的样式xml: values/styles.xml @样式/按钮文本 填补家长的空缺 包装内容 #ffffff @可拉拔/红色橙色按钮 drawable/ruddy_orange_button.xml: 但是,如果我将样式直接应用于按钮,它将起作用: <Button android:layout_w

我在看一本关于这个问题的教程。如果我直接将样式应用于按钮,它会工作,但是如果我使用
android:buttonStyle
将样式应用于主题,它不会工作

示例-以下是应用按钮样式的样式xml: values/styles.xml


@样式/按钮文本
填补家长的空缺
包装内容
#ffffff
@可拉拔/红色橙色按钮
drawable/ruddy_orange_button.xml:


但是,如果我将样式直接应用于按钮,它将起作用:

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    style="@style/ButtonText"
    android:text="hello there" />

有人指出我做错了什么吗

我在安卓2.3.3上测试了这个

源已打开。

请尝试以下操作:

<style name="ButtonText" parent="@android:style/Widget.Button">

我也遇到了这个问题。希望这个提示能帮助你

appcompat v21+您应该在主题中使用
buttonStyle
而不是
android:buttonStyle

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    style="@style/ButtonText"
    android:text="hello there" />
<style name="ButtonText" parent="@android:style/Widget.Button">