如何使用android:background=“@drawable/btn_green”更改按钮样式
我发现了一个教程,它展示了如何通过将android:background=@drawable/btn_green添加到布局xml文件来更改按钮的样式 我尝试补充:如何使用android:background=“@drawable/btn_green”更改按钮样式,android,android-layout,button,Android,Android Layout,Button,我发现了一个教程,它展示了如何通过将android:background=@drawable/btn_green添加到布局xml文件来更改按钮的样式 我尝试补充: <Button android:id="@+id/my_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello" androi
<Button
android:id="@+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:background="@drawable/btn_green"/>
我在xml文件中得到一个错误,错误是:找不到与“background”中的给定名称和值“@drawable/btn_green”匹配的资源
教程说,我需要从文件菜单中选择导入选项,将背景项目导入Eclipse
我尝试过使用“文件>导入”,但找不到与背景有关的任何内容
有人能建议我需要做什么吗?检查名为btn_green的图像是否存在于drawable-*dpi文件夹中在drawable文件夹中的btn_green中添加文件参照项目并清理和构建您遇到了以下错误:没有找到与给定名称匹配的资源,因为drawable中没有名为btn_green的图像文件夹
我想当你点击按钮时,你希望图像应该改变。为此,您需要在xml文件中使用选择器属性。我以为有一个标准的背景样式库可以添加到项目中。我想你必须自己做?