安卓的布局和控件

重点

        1.Android有几大布局

        2.Android的基础控件,常用属性有什么

内容

Android有五大布局分别是

LinearLayout (线性布局)   RelativeLayout(相对布局)

TableLayout (表格布局)     FrameLayout (帧布局)

ConstraintLayout(约束布局)

 Android的基础控件

TextView  常用属性:

<TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textSize="15dp"
        android:textColor="@color/purple_500"
        android:text="文本框控件"/>
EditView 常用属性:
<EditText
        android:id="@+id/edit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="输入文本框控件"/>
ImageView  常用属性:
<ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/a4"
        android:scaleType="fitXY"/>

Button 常用属性:

<Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:stateListAnimator="@color/purple_500"
        android:text="按钮控件"/>

RadioGroup 常用属性

<RadioGroup
        android:id="@+id/radio"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="false"
            android:text="好"/>
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="false"
            android:text="不好"/>
    </RadioGroup>

CheckBox 复选 

<CheckBox
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="苹果"/>
    <CheckBox
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="葡萄"/>
    <CheckBox
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="桃子"/>
    <CheckBox
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="橘子"/>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值