代码中动态该变shape的颜色
2016-07-25 17:25
465 查看
How
to change shape color dynamically?、
http://stackoverflow.com/questions/7164630/how-to-change-shape-color-dynamically#If you have an imageView like this:
<ImageView android:id="@+id/color_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="10dp" android:src="@drawable/circle_color"/>
which give it a drawable shape as src, you can use this code to change shape's color:
ImageView iv = (ImageView)findViewById(R.id.color_button); GradientDrawable bgShape = (GradientDrawable)iv.getDrawable(); bgShape.setColor(Color.BLACK);
相关文章推荐
- HashMap使用Comparator排序
- Yii2 behavior运用
- 简单工厂模式C++实现
- c++queue 介绍
- Ubuntu安装JDK1.8
- ubuntu源码安装django
- ASP.NET 时间方法大全
- JAVA XML的解析与创建
- 省市区代码
- 跟我读Spring——Spring源码浅析(前序)
- 串口通讯的python模块——pySerial
- c++较好程序:实现或的操作
- php验证码不能显示的原因
- C语言,struct,union
- eclipse svn插件 links方式
- 脑残用户登录代码调优
- myeclipse中的类恢复之前的版本方法
- C++ hdoj 2042 不容易系列二
- C++中的头文件和源文件
- com.alibaba.dubbo.rpc.RpcException