【发布时间】:2014-09-23 11:45:26
【问题描述】:
我如何随机打乱这个数组? 基本上我有 4 个按钮,我想随机更改按钮的文本。 例如:按钮有黑色、红色、黄色、绿色,当我点击任何一个按钮时,我需要随机更改这些文本。
这是我的代码
final int[] name={ R.string.text1,R.string.text2,R.string.text3,R.string.text4};
List<Integer> shuffle = new ArrayList<Integer>(Arrays.asList(name));
for(int i = 0; i <shuffle.Count(); i++)
b[i].Text = shuffle[i];
【问题讨论】:
-
检查this