Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.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-图像按钮(XML)不是';不行吗?_Android_Eclipse_Button_Emulation_Imageview - Fatal编程技术网

Android-图像按钮(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" /> <!--

我的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" /> <!-- 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中运行它时,我只得到第一张图像。它不做任何其他事情。我能做些什么来解决这个问题吗?

使用线性布局而不是相对布局解决了这个问题