Android系统为我们提供了大量的控件,例如:开关控件、单选按钮、多选按钮、单选菜单等等,那么这些控件如何使用呢?本篇我将带领大家一道学习一下如何使用这些控件。所谓无图无真相,先让大家看一下效果图: 下面我们就一起学习一下这些控件的使用吧,首先是我们这边效果 ...
Android系统为我们提供了大量的控件,例如:开关控件、单选按钮、多选按钮、单选菜单等等,那么这些控件如何使用呢?本篇我将带领大家一道学习一下如何使用这些控件。所谓无图无真相,先让大家看一下效果图:
下面我们就一起学习一下这些控件的使用吧,首先是我们这边效果的布局文件:
<RelativeLayout ="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${relativePackage}.${activityClass}" > <LinearLayout android:id="@+id/lative" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FF000000" > <TextView android:id="@+id/Textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <ProgressBar android:id="@+id/Barfirst" style="?android:attr/progressBarStyleHorizontal" android:max="100" android:visibility="gone" android:layout_width="200dip" android:layout_height="wrap_content" /> <ProgressBar android:id="@+id/Bartwo" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/open" /> <CheckBox android:id="@+id/reading" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="@string/reading" /> <CheckBox android:id="@+id/music" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/music" /> <CheckBox android:id="@+id/youyong" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/youyong" /> <RadioGroup android:id="@+id/radio" android:layout_width="wrap_content" android:layout_height="wrap_content" > <RadioButton android:id="@+id/nan" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="@string/nan" /> <RadioButton android:id="@+id/nv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/nv" /> </RadioGroup> <ToggleButton android:id="@+id/togbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textOn="@string/biejingquit" android:textOff="@string/biejingopen" /> <Button android:id="@+id/first" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/xiayiye" /> </LinearLayout></RelativeLayout>
原标题:Android之控件使用
关键词:Android
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。