在main.xml中的布局
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:id=”@+id/settingsLayoutId”
android:gravity=”center”>
android:id=”@+id/email”
android:layout_width=”84px”
android:layout_height=”112px”
android:layout_x=”140px”
android:layout_marginLeft=”20px”
android:background=”@drawable/emailimage”
android:scaleType=”centerInside”
/>
然后在drawable-mdpi中建立 emailimage.xml 文件
android:state_pressed=”true”
android:drawable=”@drawable/emailonmouseup”
/>
android:drawable=”@drawable/email”
/>
还有就是email.png和emailonmouseup.png图片
ok,只要在界面显示出来,就有单击改变imagebutton图片的效果了·······
这篇博客介绍了如何在Android应用中实现点击按钮改变图像的效果。通过在main.xml中设置布局属性,并在drawable资源文件中定义不同状态的图像,结合imagebutton的点击状态来切换图片。主要涉及Android UI设计、图像资源管理和事件处理。

254

被折叠的 条评论
为什么被折叠?



