一.shape画圆:
<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false" >
<solid android:color="@color/common_red" />
<padding
android:left="2dp"
android:top="1dp"
android:right="2dp"
android:bottom="1dp" />
<stroke
android:width="1dp"
android:color="@android:color/white" />
<size android:width="15dp"
android:height="15dp" />
</shape>
二.动态修改shape的颜色:
比如shape作为背景:
<ImageView
android:id="@+id/iv_change_color"
android:layout_width="match_parent"
android:layout_height="50dip"
android:background="@drawable/shape_2" />
代码里面修改背景颜色:
mImageTest
= (ImageView) findViewById(R.id.iv_change_color);
mGrad = (GradientDrawable) mImageTest.getBackground();
mGrad.setColor(color);
持续更新中……