Android-图像按钮(XML)不是';不行吗?
我的drawable文件夹中有三个图像,以及一个XML图像按钮代码:Android-图像按钮(XML)不是';不行吗?,android,eclipse,button,emulation,imageview,Android,Eclipse,Button,Emulation,Imageview,我的drawable文件夹中有三个图像,以及一个XML图像按钮代码: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">\ <item android:state_pressed="true" android:drawable="@drawable/happycarrot" /> <!--
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">\
<item android:state_pressed="true"
android:drawable="@drawable/happycarrot" /> <!-- pressed -->
<item android:state_focused="true"
android:drawable="@drawable/largerunicornbutton2" /> <!-- focused -->
<item android:drawable="@drawable/largerunicornbutton" /> <!-- default -->
</selector>
\
在我的布局文件夹中,我有我的主XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:src="@drawable/button"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
></ImageView>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
当我在Emulator中运行它时,我只得到第一张图像。它不做任何其他事情。我能做些什么来解决这个问题吗?使用线性布局而不是相对布局解决了这个问题