这只是常用的几个控件,还有第三方控件没有一一列出。
注意必须给控件设置宽高。
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
- 水平进度条 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"/>