Android小练习2——制作点菜界面

要求:制作如图所示的点菜界面
在这里插入图片描述
需要id的有:请输入姓名EditText(name);RadioGroup(gender),男RadioButton(man),女RadioButton(lady);辣CheckBox(la),海鲜CheckBox(haixian),酸CheckBox(suan);进度条SeekBar(sb),0TextView(yusuan);寻找菜品Button(xunzhao);图片ImageView(img,iv);下一个Button(next)。

把图片放入drawable

在这里插入图片描述
总体上:
在这里插入图片描述

在activity_main.xml中

开始选餐
<!--    开始选餐-->
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#00FF00"
        android:gravity="center"
        android:text="开始选餐"
        android:textSize="30sp"></TextView>
姓名栏

EditText中使用权重

    <!--    姓名栏-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="姓名:"
            android:textSize="30sp"></TextView>

        <EditText
            android:id="@+id/name"
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="请输入姓名"></EditText>
    </LinearLayout>
性别栏

android:checked="true"设置默认选中“男”

<!--    性别栏-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="性别:"
            android:textSize="30sp"></TextView>

        <RadioGroup
            android:id="@+id/gender"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:orientation="horizontal">

            <RadioButton
                android:id="@+id/man"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="true"
                android:text="男"></RadioButton>

            <RadioButton
                android:id="@+id/lady"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="女"></RadioButton>
        </RadioGroup>
    </LinearLayout>
喜好栏
<!--    喜好栏-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="喜好:"
            android:textSize="30sp"></TextView>

        <CheckBox
            android:id="@+id/la"
            android:layout_width
  • 0
    点赞
  • 35
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值