for (int i = 0; i < allLL.getChildCount(); i++) {
if (allLL.getChildAt(i) instanceof TextView) {
TextView tv = (TextView) allLL.getChildAt(i);
tv.setTextColor(Color.RED);
}
if (allLL.getChildAt(i) instanceof Button) {
Button bn = (Button) allLL.getChildAt(i);
bn.setTextColor(Color.BLUE);
}
if (allLL.getChildAt(i) instanceof ImageView) {
ImageView iv = (ImageView) allLL.getChildAt(i);
iv.setBackgroundColor(Color.YELLOW);
}
}
Android——遍历分别设置布局中不同控件的样式
最新推荐文章于 2023-09-23 21:52:16 发布