Android 个人信息填写 小控件练习

这篇博客通过一个个人信息填写的小demo,介绍了如何在Android中使用textView、editText、radioGroup、radioButton、checkBox等控件。用户输入姓名,选择性别和爱好后,点击确定按钮,选择的内容将显示在下方。点击取消可以清空姓名,但目前无法清除已选的checkBox选项。
摘要由CSDN通过智能技术生成

以个人呢信息填写小demo来练习使用textView、editText、radioGroup、radioButton、checkBox小控件的使用:

主界面如下:

当输入姓名,选择性别,选择爱好后点击确定按钮会把选择的内容输入到下面黑框中:

代码如下:

layout布局代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >

    <TextView
        android:id="@+id/textview1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp"
        android:layout_gravity="center"
        android:text="请填写您的个人信息" 
        android:textSize="18sp"
        />
    
    
    <LinearLayout 
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
        <TextView
        android:id="@+id/textview2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="姓名:" 
        android:textSize="15sp"
        />
        
        <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="15sp"
        />
        
    </LinearLayout>
    
    <LinearLayout 
        android:id="@+id/linearLayout2"
        android:layout_width="ma
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值