我正在嘗試爲我的應用創建一個捐贈菜單。我已經想出了當用戶點擊捐贈時,更多的按鈕出現了多少。現在,如果再次點擊相同的按鈕,我希望能夠使數量按鈕消失。我想要保留常規的DonateButton。我會怎麼做呢?按鈕菜單Android
我已經設置使用purchaseButton.setVisibility(View.GONE);
這裏是點擊按鈕和其他按鈕出現的代碼它作爲無形的:
public void onClick(View v) {
switch (v.getId()) {
case R.id.DonateButton:
purchaseButton.setVisibility(View.VISIBLE);
purchaseButton2.setVisibility(View.VISIBLE);
purchaseButton3.setVisibility(View.VISIBLE);
case R.id.Donate:
if(BillingHelper.isBillingSupported()){
BillingHelper.requestPurchase(mContext, "donate");
// android.test.purchased or android.test.canceled or android.test.refunded
} else {
Log.i(TAG,"Can't purchase on this device");
}
break;
default:
// nada
Log.i(TAG,"default. ID: "+v.getId());
break;
case R.id.Donatetwo:
if(BillingHelper.isBillingSupported()){
BillingHelper.requestPurchase(mContext, "donate2");
// android.test.purchased or android.test.canceled or android.test.refunded
} else {
Log.i(TAG,"Can't purchase on this device");
}
break;
case R.id.Donatethree:
if(BillingHelper.isBillingSupported()){
BillingHelper.requestPurchase(mContext, "donate3");
// android.test.purchased or android.test.canceled or android.test.refunded
} else {
Log.i(TAG,"Can't purchase on this device");
}
break;
}
}
截圖我的意思:
圖片網址(沒有10聲譽): http://i.stack.imgur.com/AMdhS.png
我試圖t說的是。
- 該應用程序剛剛顯示「捐贈!」按鈕。 =>
- 用戶點擊「捐贈!」按鈕。 =>
- 出現按鈕「捐贈$ 1」,「捐贈$ 3」和「捐贈$ 5」。 => 我需要幫助
- 用戶想要關閉「捐贈$ 1」,「捐贈$ 3」和「捐贈$ 5」按鈕。 =>
- 要關閉它們,請點擊「捐贈!」。這是他們用來打開這一切的按鈕。 =>
- 「捐贈1美元」,「捐贈3美元」和「捐贈5美元」消失。
我希望它仍然允許它們不止一次打開和關閉這些按鈕。
問題不明確**數量按鈕消失,如果他們再次點擊相同的按鈕**意味着什麼?請張貼截圖,然後明確。 – 2011-12-20 09:28:46
我已添加圖片並試圖使其更清晰。希望能幫助到你。 :) – 2011-12-20 09:44:05