WEB开发网
开发学院手机开发Android 开发 android ui imagebutton 阅读

android ui imagebutton

 2010-04-05 18:50:00 来源:WEB开发网   
核心提示:1. drawable/imagebutton.xml2.3. < ?xml version="1.0" encoding="utf-8"? >4.5. < selector6.7. xmlns:android="http://schemas.andr

1. drawable/imagebutton.xml

2.

3. < ?xml version="1.0" encoding="utf-8"? >

4.

5. < selector

6.

7. xmlns:android="http://schemas.android.com/apk/res/android" >

8.

9. < item

10.

11. android:state_focused="true"

12.

13. android:state_pressed="false"

14.

15. android:drawable="@drawable/btnfocused" / >

16.

17. < item

18.

19. android:state_focused="true"

20.

21. android:state_pressed="true"

22.

23. android:drawable="@drawable/btnfocusedpressed" / >

24.

25. < item

26.

27. android:state_focused="false"

28.

29. android:state_pressed="true"

30.

31. android:drawable="@drawable/btnpressed" / >

32.

33. < item android:drawable="@drawable/btndefault" / >

34.

35. < /selector >

36.

37. 然后,在main.xml 中将advancedbutton 赋值给Button 组件中background 的属性。

38.

39. layout/main.xml

40.

41. < Button

42.

43. android:id="@+id/myButton1"

44.

45. android:background="@drawable/ imagebutton "

46.

47. android:layout_width="wrap_content"

48.

49. android:layout_height="wrap_content"

50.

51. android:text="@string/str_button1"

52.

53. / >

Tags:android ui imagebutton

编辑录入:coldstar [复制链接] [打 印]
赞助商链接