移动终端应用开发第六课

本文深入探讨了Android中RadioButton与RadioGroup的使用,展示了如何构建有效的单选按钮组,以及Log类的日志记录方法,包括不同级别的日志打印功能。同时,通过实例代码演示了一个登录页面的设计过程。

RadioButton

RadioButton为单选按钮,它需要与RadioGroup配合使用,提供两个或多个互斥的选项集

RadioGroup是单选组合框,可容纳多个RadioButton,并把它们组合在一起,实现单选状态

在这里插入图片描述

Android的日志工具Log

Android中的日志工具类是Log(android.util.Log)

  1. Log.v ( ) :用于打印那些最为琐碎、意义最小的日志信息
  2. Log.d ( ) :用于打印一些调试信息
  3. Log.i ( ) :用于打印一些比较重要的数据
  4. Log.w ( ) :用于打印一些警告信息
  5. Log.e ( ) :用于打印程序中的错误信息
    在这里插入图片描述
    在这里插入图片描述 ### 页面的创建
    上课敲的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:background="@drawable/picture1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Login">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@color/black"
        android:layout_marginTop="150dp"
        android:src="@drawable/icon_smart_park" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="18dp"
        android:layout_marginRight="18dp"
        android:background="@drawable/input_normal"
        android:hint="请输入账号"
        android:textSize="36dp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="18dp"
        android:layout_marginRight="18dp"
        android:background="@drawable/input_normal"
        android:hint="请输入密码"
        android:textSize="36dp"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="18dp"
        android:layout_marginRight="18dp"
        android:orientation="horizontal">
        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="记住密码" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="                                                             修改密码"/>
    </LinearLayout>
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:background="@drawable/btn_login_normal"/>
    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:background="@drawable/btn_register_normal"/>

</LinearLayout>

效果图
在这里插入图片描述

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值