ImageButton 支持.9.png格式,ImageView 不支持
<ImageView
android:id="@+id/call_iv"
android:focusable="false"
android:layout_marginLeft="10dip"
android:layout_marginBottom="13px"
android:background="@drawable/call_button_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
======
call_button_style.xml
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
>
<item
android:state_focused="false"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/call1"
>
</item>
<item
android:state_focused="false"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/call2"
>
</item>
<item
android:state_focused="true"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/call2"
>
</item>
<item
android:state_pressed="true"
android:drawable="@drawable/call2"
>
</item>
</selector>
=======================
<ImageButton
android:id="@+id/direction_ibtn"
android:textSize="28px"
android:layout_marginLeft="40px"
android:src="@drawable/eventupload_direction"//是一个图片
android:background="#00000000"//去掉边框
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
ImageView与ImageButton
最新推荐文章于 2024-07-25 19:04:18 发布