基本控件学习以( RadioGroup和RadioButton 的学习使用)

单选框学习:

XML文件部分代码:

<RadioGroup android:id="@+id/radGSex"
    android:layout_width="200dp" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"
    android:checkedButton="@+id/radMale">
    <RadioButton android:id="@+id/radMale"
        android:textSize="20sp"
        android:text="@string/male"
        />
    <RadioButton android:id="@+id/radFemale"
         android:textSize="20sp"
        android:text="@string/female"
        />
</RadioGroup>

string.xml中设计到的文件是:

<string name="male">男生</string>
<string name="female">女生</string>

  获取选项结果的代码:

private RadioGroup radGSex = (RadioGroup)findViewById(R.id.radGSex);

 

以上代码  《婚姻转换简单的将代码》

posted @ 2014-12-06 17:14  菜鸟的学习  阅读(257)  评论(0编辑  收藏  举报