【问题标题】:Android Segmented Radio ButtonAndroid 分段单选按钮
【发布时间】: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


【解决方案1】:

您可以按照上面提到的方式实现一些方法:

解决方案 1:在点击相关按钮时设置特定布局的可见性。

解决方案 2: 您可以将ViewFlipper 设置为 3 种不同的布局,您只需设置编号即可。子项一次显示在 ViewFlipper 中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多