当前位置:网站首页>Radiogroup (radio box)
Radiogroup (radio box)
2022-07-27 19:53:00 【Ashurol】
public class MainActivity extends ActionBarActivity implements OnCheckedChangeListener{
RadioGroup rp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rp=(RadioGroup) findViewById(R.id.radioGroup1);
rp.setOnCheckedChangeListener(this);
}
@Override
public void onCheckedChanged(RadioGroup arg0, int CheckedId) {
// TODO Auto-generated method stub
switch(CheckedId)
{
case R.id.radio0:
Toast.makeText(this, " You are a boy? ", Toast.LENGTH_SHORT).show();
break;
case R.id.radio1:
Toast.makeText(this, " You're a girl? ", Toast.LENGTH_SHORT).show();
break;
}
}
} Remember not to guide the bag android.widget.RadioGroup.OnCheckedChangeListener<pre name="code" class="html"><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.xin.radiogroup.MainActivity" >
<RadioGroup
android:id="@+id/radioGroup1"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="14dp" >
<RadioButton
android:id="@+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text=" male " />
<RadioButton
android:id="@+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Woman " />
</RadioGroup>
</RelativeLayout>

边栏推荐
- Complex number proof of solvability of regular 17 sided ruler and gauge drawing
- [basic knowledge of deep learning - 45] distance calculation methods commonly used in machine learning
- [basic knowledge of deep learning - 44] the method of realizing multiple classification by logistic regression
- Detailed interpretation of IEC104 protocol (II) interaction process and protocol analysis
- [basic knowledge of in-depth learning - 40] Why does CNN have more advantages than DNN in the field of images
- JS 寻找所有节点sibling childNodes children
- Sharepreference (storage)
- Broadcastreceiver (broadcast)
- Come to sword finger offer 03. Repeated numbers in the array
- 函数总结
猜你喜欢

JS 事件监听 鼠标 键盘 表单 页面 onclick onkeydown onChange
![[RCTF2015]EasySQL-1|SQL注入](/img/69/aa1fc60ecf9a0702d35d876e8c3dda.png)
[RCTF2015]EasySQL-1|SQL注入

Map和Set

Come to sword finger offer 03. Repeated numbers in the array

ContentProvider of four components

Gesturedetector (gesture recognition)

Sharepreference (storage)

JS find all nodes sibling childNodes children

SystemService(系统服务)

SQlife(数据库)
随机推荐
Binary search tree
内置模块10.18
I want to consult. Our maxcompute spark program needs to access redis, development environment and production environment redis
SystemService(系统服务)
Intent(有无返回值得跳转)
Detailed interpretation of IEC104 protocol (I) protocol structure
The first Xiaolong 765G! Redmi K30 5g release: support 5g dual-mode 120Hz screen, priced from 1999 yuan
File operation protection
Togglebutton (button switch)
Embedded C language pointer alias
FileOutputStream(文件储存)与FileInputStream(文件读取)
归一化(Normalization)和标准化(Standardization)
HDU1171_ Big event in HDU [01 backpack]
静态试验。2021.01 .13
ContextMenu (context menu)
[basic knowledge of deep learning - 42] detailed explanation of logistic regression
Systemservice (system service)
Intel's process roadmap for the next 10 years is exposed: 1.4nm process will be launched in 2029! How?
Map and set
RadioGroup(单选框)