歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Android游戲開發系統控件-CheckBox

Android游戲開發系統控件-CheckBox

日期:2017/3/1 10:22:57   编辑:Linux編程

Android游戲開發系統控件-CheckBox

CheckBox是Android系統最普通的UI控件,繼承了Button按鈕

下面通過一個實例來學習

功能:實現復選框的功能

創建項目“CheckBoxProject”

運行項目效果截圖:

代碼實現:

=>>main.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent"
  5. android:orientation="vertical" >
  6. <TextView
  7. android:layout_width="fill_parent"
  8. android:layout_height="wrap_content"
  9. android:text="@string/hello" />
  10. <CheckBox
  11. android:layout_width="fill_parent"
  12. android:layout_height="wrap_content"
  13. android:text="@string/cb1"
  14. android:id="@+id/cb1"
  15. />
  16. <CheckBox
  17. android:layout_width="fill_parent"
  18. android:layout_height="wrap_content"
  19. android:text="@string/cb2"
  20. android:id="@+id/cb2"
  21. />
  22. <CheckBox
  23. android:layout_width="fill_parent"
  24. android:layout_height="wrap_content"
  25. android:text="@string/cb3"
  26. android:id="@+id/cb3"
  27. />
  28. </LinearLayout>
Copyright © Linux教程網 All Rights Reserved