大佬教程收集整理的这篇文章主要介绍了ImageButton在Android中使用Transitions,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
下面是在屏幕左下角的屏幕上创建图像按钮的XML布局代码.它目前从一个图像到另一个图像突然忽略了转换XMl.
SELEctor_button.xml
<?xml version="1.0" encoding="utf-8"?> <SELEctor xmlns:android="http://scheR_569_11845@as.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/transition_normal_to_pressed" /> <!-- pressed --> <item android:state_focused="true" android:drawable="@drawable/transition_pressed_to_normal" /> <!-- focused --> <item android:drawable="@drawable/menu_normal" /> <!-- default --> </SELEctor>
transition_normal_to_pressed.xml
<?xml version="1.0" encoding="utf-8"?> <transition xmlns:android="http://scheR_569_11845@as.android.com/apk/res/android"> <item android:drawable="@drawable/menu_pressed" /> <item android:drawable="@drawable/menu_normal" /> </transition>
activity.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://scheR_569_11845@as.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageButton android:id="@+id/btnMenu" android:BACkground="@android:color/transparent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/SELEctor_button" android:layout_alignParentLeft="true" android:layout_alignParentBottom="true" /> </RelativeLayout>
ImageButton button = (ImageButton) findViewById(R.id.button); TransitionDrawable drawable = (TransitionDrawablE) button.getDrawable(); drawable.startTransition(500);
drawable.reverseTransition(500)将从当前状态转换为转换.
有关进一步说明,请参阅Transition Drawable以及TransitionDrawable.html#reverseTransition(int).
以上是大佬教程为你收集整理的ImageButton在Android中使用Transitions全部内容,希望文章能够帮你解决ImageButton在Android中使用Transitions所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。