第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

通過循環(huán)數(shù)組設(shè)置button的id

通過循環(huán)數(shù)組設(shè)置button的id

ibeautiful 2019-03-14 14:15:42
通過循環(huán)設(shè)置5個button的id,每次都隨機分配。隨機分配沒有問題。在使用兩個方法,隨機設(shè)置button的id以及設(shè)置文本的時候出現(xiàn)錯誤。弄得很混亂不知道問題出在哪里了?Button b1, b2, b3, b4, b5; Button[] buttons = { b1, b2, b3, b4, b5 }; public void shuffleButtons() {         Integer[] Id = { R.id.bChoice1, R.id.bChoice2, R.id.bChoice3,                 R.id.bChoice4, R.id.bChoice5 };         ArrayList<Integer> buttonId = new ArrayList<Integer>(Arrays.asList(Id));         Collections.shuffle(buttonId);             for (int x = 0; x < 5; x++) {                 for (Button b : buttons) {                     b = (Button) findViewById(buttonId.get(x));                 }             }     }public void setButtonTxt() {             for (Button b : buttons) {                 for (int x = 0; x <= buttons.length; x++) {                     b.setText(textList.get(x));                 }             }     }
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 353 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號