如何在android中使用xml绘制图形
需要使用xml绘制以下圆形,红色形状如何在android中使用xml绘制图形,android,android-xml,android-drawable,xml-drawable,Android,Android Xml,Android Drawable,Xml Drawable,需要使用xml绘制以下圆形,红色形状 是否可以仅使用xml绘制此圆?要以编程方式绘制圆,您可以使用这种方式,这对我很有用 ShapeDrawable biggerCircle= new ShapeDrawable( new OvalShape()); biggerCircle.setIntrinsicHeight( 60 ); biggerCircle.setIntrinsicWidth( 60);
是否可以仅使用xml绘制此圆?要以编程方式绘制圆,您可以使用这种方式,这对我很有用
ShapeDrawable biggerCircle= new ShapeDrawable( new OvalShape());
biggerCircle.setIntrinsicHeight( 60 );
biggerCircle.setIntrinsicWidth( 60);
biggerCircle.setBounds(new Rect(30, 30, 30, 30));
biggerCircle.getPaint().setColor(Color.parseColor(first));//give any color here
holder.firstcolor.setBackgroundDrawable(biggerCircle);
我已经创建了一个类似的形状,外部的灰色圆圈包含内部的红色圆圈。代码如下:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<solid android:color="#E84F3D" />
<stroke
android:width="15dp"
android:color="#BEBEBE" />
</shape>
可以使用以下XML代码创建圆: 你能帮我吗
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
<solid android:color="#c4bfbf"/>
</shape>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#FF0000" />
<padding android:bottom="1dp" android:left="10dp" android:right="10dp" android:top="1dp"/>
<corners
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp"/>
</shape>