zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

android中的单选和多选框

Android 单选 选框
2023-09-14 08:59:45 时间

先展示一下效果图

大致代码如下:

复制代码
 1 ?xml version="1.0" encoding="utf-8"? 

 2 TableLayout xmlns:android="http://schemas.android.com/apk/res/android"

 3 android:layout_width="fill_parent"

 4 android:layout_height="fill_parent" 

 6 TableRow

 7 android:id="@+id/tableRow1"

 8 android:layout_width="wrap_content"

 9 android:layout_height="wrap_content" 

11 TextView

12 android:id="@+id/textView1"

13 android:layout_width="wrap_content"

14 android:layout_height="wrap_content"

15 android:text="性别:"

16 android:textSize="11pt" / 

18 RadioGroup

19 android:layout_gravity="center_horizontal"

20 android:orientation="horizontal" 

22 RadioButton

23 android:id="@+id/radioButton1"

24 android:layout_width="wrap_content"

25 android:layout_height="wrap_content"

26 android:text="男" / 

28 RadioButton

29 android:id="@+id/radioButton2"

30 android:layout_width="wrap_content"

31 android:layout_height="wrap_content"

32 android:text="女" / 

33 /RadioGroup 

34 /TableRow 

36 TableRow

37 android:id="@+id/tableRow2"

38 android:layout_width="wrap_content"

39 android:layout_height="wrap_content" 

41 TextView

42 android:id="@+id/textView2"

43 android:layout_width="wrap_content"

44 android:layout_height="wrap_content"

45 android:text="喜欢的颜色:" / 

47 LinearLayout

48 android:layout_width="wrap_content"

49 android:layout_height="wrap_content"

50 android:orientation="vertical" 

52 CheckBox

53 android:id="@+id/checkBox2"

54 android:layout_width="wrap_content"

55 android:layout_height="wrap_content"

56 android:text="红色" / 

58 CheckBox

59 android:id="@+id/checkBox3"

60 android:layout_width="wrap_content"

61 android:layout_height="wrap_content"

62 android:text="绿色" / 

64 CheckBox

65 android:id="@+id/checkBox1"

66 android:layout_width="wrap_content"

67 android:layout_height="wrap_content"

68 android:text="蓝色" / 

69 /LinearLayout 

70 /TableRow 

72 /TableLayout 
复制代码

Android组件化开发(七)--从零开始教你分析项目需求并实现 前面几篇文章我们封装了几个组件化功能组件:包括:**网络请求组件,图片加载请求组件,应用保活组件,音乐播放组件封装。** 每个组件都可以直接拿到自己项目中使用,当然还需根据自己项目要求进行优化。
Android组件化开发(六)-- 短视频播放组件封装 前面几篇文章我们封装了几个组件化功能组件: 包括:`网络请求组件`,`图片加载请求组件`,`应用保活组件`,`音乐播放组件封装`。 每个组件都可以直接拿到自己项目中使用,当然还需根据自己项目要求进行优化。
Android组件化开发(五)--完整版音乐播放组件的封装 前面几篇系列文章我们讲解了`组件化开发`中几个常用功能组件的开发,包括:`网络请求组件`,`图片加载请求组件`,`应用保活组件`。今天我们来封装一个`音乐播放组件`。
Android组件化开发(四)--进程保活组件的封装 前面文章我们封装了网络请求组件`lib_nework`和图片加载组件`lib_image_loader`,今天我们来封装一个进程保活的组件`lib_pull_alive`
Android组件化开发(二)--网络请求组件封装 前面一篇文章我们讲解了`maven私服`的搭建,maven私服在`组件化框架`中有一个很重要的地位就是可以将我们的`lib`库放到局域网中,供公司其他开发者使用,实现类库的分享。 下面是这个系列准备实现的一个`组件化实战项目框架`: