【发布时间】:2010-08-20 19:51:57
【问题描述】:
我的可绘制文件夹中有三张图片,以及一个 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>
当我在模拟器中运行它时,我只会得到第一张图像。它不做任何其他事情。有什么办法可以解决这个问题吗?
【问题讨论】:
标签: android eclipse button emulation imageview