Android layout 在Android中创建渐变形状
如何使用渐变线作为可绘制资源创建圆形,如下所示:Android layout 在Android中创建渐变形状,android-layout,android-drawable,Android Layout,Android Drawable,如何使用渐变线作为可绘制资源创建圆形,如下所示: 这是一个简单的圆圈,在Android中是可绘制的 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#666666"/>
这是一个简单的圆圈,在Android中是可绘制的
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#666666"/>
<size
android:width="120dp"
android:height="120dp"/>
</shape>
您还可以应用Java代码中的颜色过滤器(请参见Drawable类)
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="8"
android:useLevel="false">
<gradient
android:angle="270"
android:centerX="50%"
android:centerY="50%"
android:endColor="#FF4AA7D0"
android:gradientRadius="100"
android:startColor="#FFE66433"
android:type="linear"
android:useLevel="false" />
</shape>