算法把rootview中所有的button改变背景
来源:互联网 发布:淘宝瑕疵冰箱上当受骗 编辑:程序博客网 时间:2024/06/05 18:24
if (view == null || !(view instanceof ViewGroup))
return;
Stack m = new Stack<>();
while (view != null) {
ViewGroup tmpGroup = (ViewGroup) view;
int count = tmpGroup.getChildCount();
for (int i = 0; i < count; i++) {
View child = tmpGroup.getChildAt(i);
if (child instanceof ViewGroup) m.add(child);
else if (child instanceof Button) { child.setBackgroundColor(color);
} }
if (m.isEmpty()) break;
else view = m.pop();
}
}
return;
Stack m = new Stack<>();
while (view != null) {
ViewGroup tmpGroup = (ViewGroup) view;
int count = tmpGroup.getChildCount();
for (int i = 0; i < count; i++) {
View child = tmpGroup.getChildAt(i);
if (child instanceof ViewGroup) m.add(child);
else if (child instanceof Button) { child.setBackgroundColor(color);
} }
if (m.isEmpty()) break;
else view = m.pop();
}
}
阅读全文
0 0
- 算法把rootview中所有的button改变背景
- 题目:给最外层的rootview,把这个根视图下的全部button背景设置成红色,手写代码,不许用递归
- 改变选中的Button背景样式
- 改变android5.0Button的背景颜色
- 全局改变所有Activity的背景
- android Button 的绑定,监听及其背景的改变
- 把窗体中所有的Button的Enabled置为False
- android点击Button后,buttton的背景和颜色改变
- Button点击背景和字体颜色改变的实现方法
- 把有界凸空间中所有点输出的算法讨论
- 获得activity的rootview
- 改变android中button的样式
- 改变UIALertView中button的字体颜色
- 使用xml文件设置button按下后改变该button的背景
- 多个button,改变选中button的背景颜色、字体颜色
- wp开发:Button按下后空白背景改变
- UGUI button按下改变背景
- button改变背景与文字颜色
- codis离线迁移方案
- Prime Ring Problem
- 仿房产销冠APP销控表界面-多RecyclerView同步滚动
- 博弈搜索练习-BFS-秋神也玩亚马逊
- Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.Proce
- 算法把rootview中所有的button改变背景
- Linux常用命令
- Oracle---Tip for SQL Database tuning and performance
- mysql获取各种时间段
- 分布式消息队列RocketMQ之Netty -- 1+N+M1+M2模型
- 《TP5.0学习笔记---请求和响应篇》
- IP地址异形
- linux转移/home目录分区与磁盘配额的配置
- CSS背景、尺寸、盒子模型