Java 带图像的android按钮
前两个字段是安卓ICS的短信应用程序,第三个是我的<我这样做:Java 带图像的android按钮,java,android,image,button,drawable,Java,Android,Image,Button,Drawable,前两个字段是安卓ICS的短信应用程序,第三个是我的
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/searchfield"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/newItem"/>
<ImageButton
android:id="@+id/newItem"
android:layout_height="40dip"
android:layout_width="40dip"
android:layout_alignParentTop="@+id/searchfield"
android:adjustViewBounds="true"
android:contentDescription="Add"
android:layout_alignParentRight="true"/>
</RelativeLayout>
我得到了一个非常糟糕的箭头,我有问题创建蓝色背景的下降。我遗漏了什么吗?对于要将背景设置为具有所需颜色的图像按钮。至于你想做的形象,是一种挫折,而不是一种挫折。通过这种方式,您可以更改以调整图像的绘制方式。我会用中间的箭头来得到最漂亮的箭头。在ImageButton上,背景的行为与任何视图上的行为完全相同,图像资源是内容,并绘制在背景之上
Drawable img = getResources().getDrawable( R.drawable.light_send );
newItem.setBackgroundDrawable(img);