Android基础UI控件

这只是常用的几个控件,还有第三方控件没有一一列出。
注意必须给控件设置宽高。

Button

 <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:text="按钮"/>

TextView

<TextView
    android:id="@+id/textview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="文字"
    android:textSize="25sp"
    android:textColor="@color/colorAccent"/>

EditText

<EditText
    android:id="@+id/edittext"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="输入框"/>

CheckBox

<CheckBox
    android:id="@+id/checkbox"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="多选框"/>

RadioGroup,RadioButton

<RadioGroup
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <RadioButton
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:button="@null"
            android:text="按钮1"/>
        <RadioButton
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:button="@null"
            android:text="按钮2"/>
        <RadioButton
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:button="@null"
            android:text="按钮3"/>
    </RadioGroup>

ImageView图片

  <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@mipmap/ic_launcher"/>

ProgressBar

  1. 水平进度条 style=”?android:attr/progressBarStyleHorizontal”
    2.一个大圆形样式 style=”?android:attr/progressBarStyleLarge”
    3.小圆形样式 style=”?android:attr/progressBarStyleSmallTitle”
    ProgressBar的详细使用
 <ProgressBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        style="?android:attr/progressBarStyleHorizontal"  
        />

SeekBar拖动条
设置拖动条的条形形状
android:progressDrawable=”@mipmap/ic_launcher”
设置拖动条的拖动按钮
android:thumb=”@mipmap/ic_launcher”
详细使用解说

<SeekBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />

ListView条目

 <ListView
        android:id="@+id/listview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

GridView九宫格

 <GridView
         android:id="@+id/gridview"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:numColumns="3"/>

ViewPager

<android.support.v4.view.ViewPager
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

FrameLayout碎片

 <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值