Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.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 将主题应用于应用程序的问题_Android_Xml_Eclipse - Fatal编程技术网

Android 将主题应用于应用程序的问题

Android 将主题应用于应用程序的问题,android,xml,eclipse,Android,Xml,Eclipse,我正在尝试将一个主题应用到我的整个android应用程序中,目前只改变应用程序中所有按钮的外观。目前我没有错误,应用程序将在我的虚拟机中启动(我正在使用eclipse)。我的问题是,尽管没有任何错误,但主题没有应用到应用程序。我是这样安排的: res/color/custom_button.xml: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com

我正在尝试将一个主题应用到我的整个android应用程序中,目前只改变应用程序中所有按钮的外观。目前我没有错误,应用程序将在我的虚拟机中启动(我正在使用eclipse)。我的问题是,尽管没有任何错误,但主题没有应用到应用程序。我是这样安排的:

res/color/custom_button.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" >
        <shape>
            <gradient
                android:startColor="@color/yellow1"
                android:endColor="@color/yellow2"
                android:angle="270" />
            <stroke
                android:width="3dp"
                android:color="@color/grey05" />
            <corners
                android:radius="3dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>

    <item android:state_focused="true" >
        <shape>
            <gradient
                android:endColor="@color/orange4"
                android:startColor="@color/orange5"
                android:angle="270" />
            <stroke
                android:width="3dp"
                android:color="@color/grey05" />
            <corners
                android:radius="3dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>

    <item>        
        <shape>
            <gradient
                android:endColor="@color/white1"
                android:startColor="@color/white2"
                android:angle="270" />
            <stroke
                android:width="3dp"
                android:color="@color/grey05" />
            <corners
                android:radius="3dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>

</selector>

我所有的颜色都是在res/values/colors.xml中定义的,我知道我的设置是正确的。Eclipse似乎在定位所有内容方面都没有问题,所以我不明白为什么没有应用主题,主要是我对按钮所做的更改。

你能发布屏幕截图说明它应该是什么样子和它确实是什么样子吗?安卓:theme=“@styles/PurdueTheme”>在应用程序部分,所以我知道我把它放在了正确的位置place@hichris123,现在它正在显示按钮的默认全息暗主题,因此它们是黑色的。正如您在上面的custom_button.xml代码中所看到的,按钮在默认状态下应该是白色的
    <?xml version="1.0" encoding="utf-8"?>
    <resources >
      <style name="PurdueButtons" parent="android:style/Widget.Button">
          <item name="android:background">@color/custom_button</item>
      </style>
      <style name="PurdueTheme" parent="android:Theme.Holo">
          <item name="android:buttonStyle">@style/PurdueButtons</item>
      </style>
    </resources>
android:theme="@style/PurdueTheme" >