【发布时间】:2013-02-18 05:55:56
【问题描述】:
我已经从https://github.com/makeramen/android-segmentedradiobutton 导入了这个方法。 单击每个按钮时如何显示视图(可能是 Listview、Imageview 或其他)。
这里是代码..
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
if (group == segmentText) {
if (checkedId == R.id.button_one) {
Toast.makeText(getApplicationContext(), "Featured",
Toast.LENGTH_SHORT).show();
} else if (checkedId == R.id.button_two) {
Toast.makeText(getApplicationContext(), "NearBy",
Toast.LENGTH_SHORT).show();
} else if (checkedId == R.id.button_three) {
Toast.makeText(getApplicationContext(), "Whatsup",
Toast.LENGTH_SHORT).show();
}
}
}
【问题讨论】:
-
尝试设置每个布局消失/可见的可见性
标签: android radio-button uisegmentedcontrol radio-group