我已经从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();
}
}
}