RadioGroup初识
来源:互联网 发布:淘宝短链 编辑:程序博客网 时间:2024/05/21 17:39
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_radio_button" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.axnet.buju0711.RadioButtonActivity"> <!--checked默认选择--> <RadioGroup android:id="@+id/rg1" android:layout_height="wrap_content" android:layout_width="match_parent" android:orientation="horizontal" > <RadioButton android:id="@+id/man" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="男" android:layout_weight="1" android:checked="true" /> <RadioButton android:id="@+id/woman" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1" android:text="女" /> </RadioGroup> <TextView style="@style/wr" android:id="@+id/tv1" android:text="text" android:textSize="28sp" /></LinearLayout>
public class RadioButtonActivity extends AppCompatActivity { private RadioGroup rg1; private TextView tv1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_radio_button); init(); rg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId){ case R.id.woman: tv1.setText("women"); break; case R.id.man: tv1.setText("man"); default: break; } } }); } private void init() { rg1=(RadioGroup)findViewById(R.id.rg1); tv1=(TextView)findViewById(R.id.tv1); }}
阅读全文
0 0
- RadioGroup初识
- RadioGroup
- RadioGroup
- RadioGroup
- RadioGroup
- RadioGroup
- RadioGroup
- RadioGroup
- radiogroup使用
- RadioGroup && RadioButton
- radioGroup、combo
- radioGroup监听
- Extjs radiogroup
- 04 RadioGroup
- RadioGroup,RadioButton
- Extjs radiogroup
- RadioGroup用法
- RadioButton&RadioGroup
- 剑指offer 数值的整数次方
- ue4 c++ 接口写法
- 机器学习笔记之线性回归的正则化
- Java集合---Stack的源码分析
- lua获取get请求中的参数
- RadioGroup初识
- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation
- 欢迎使用CSDN-markdown编辑器
- form表单提交的几种方式
- performance-test-of-zhifubao
- 宽温低功耗无线网桥
- Oracle查锁表
- intentfilter的匹配规则
- webservice额外补充