发布网友
共3个回答
热心网友
请说明完整你的问题。
RadioButton carButton = (RadioButton) findViewById(R.id.search_car);
RadioButton busButton = (RadioButton) findViewById(R.id.search_bus);
RadioButton walkButton = (RadioButton) findViewById(R.id.search_walk);
以上是三个button的初始化,也就是找到改按钮。
如果需要设置某个按钮是被选中的
请调用performClick();方法
例如:
carButton.performClick();
热心网友
1、XML中直接调用组件RADIOGROOUP,注意它集成linerlayout,所以可以规定方向,可以添加子view,一般子view都是radiobutton
2、JAVA代码中可以直接new出来,package android.widget包下的,通linerlayout一样,可以代码设置方向setOriention(),可以addView();
热心网友
加入Radio控件,设置Checked属性