Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个由九个按钮组成的网格,目前每个按钮都将数字 1-9 显示为文本,另一个按钮将在单击时将编号按钮文本更改为 1-9 的不同数字。所以基本上它看起来会改变按钮,但实际上它只是改变文本。或者只是洗牌更容易?
我可以将数字 1-9 放入字符串数组中以使按钮文本更改为数组中的项目吗?以及如何确保它使用所有数字 1-9 一次?
我认为更改按钮文本会比重新对齐按钮本身更容易和更快会更复杂。要更改按钮文本值,请使用它。我想你知道这一点。
Button yourButton = (Button)findViewById(R.id.yourbt); yourButton .setText(stringarrayvalue);
所以使用按钮的 ArrayList 并从中更改按钮的值..