2013-03-04 49 views
1

enter image description here的Android分段單選按鈕

我從https://github.com/makeramen/android-segmentedradiobutton進口這種方法。 如何顯示視圖(可以是列表視圖,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(); 
     } 
    } 
} 
+0

嘗試設置每個佈局的知名度不見了/可見光 – Cjames 2013-03-04 07:45:29

回答

-1

有你所提到的可以實現的一些方法:

解決方案1:特定佈局的設置可見性和相關時,按鈕點擊。

解決方案2:你可以帶3個不同的佈局ViewFlipper,你只需要設置no。一次將顯示在ViewFlipper內部的子項。