画出不同的看法多个形状
问题描述:
我创建了一个包含两个图像视图中的XML文件。我想在每个视图的中心绘制两个不同的圈子(不同的大小,颜色)。我怎样才能做到这一点,尤其是坐标。谢谢!
I created a XML file containing two image view. I want to draw two different circles(different size, color) in the center of each view. How can I do that, especially the coordinates. Thanks!
答
你可以做,使用可绘制形状
...
you can do that using shape Drawables
...
创建 circle.xml
在可绘制
文件夹...
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="@android:color/transparent"/>
<corners android:radius="12px"/>
<stroke android:width="2dp" android:color="#000000"/>
</shape>
在使用你的的ImageView
<ImageView android:id="@+id/circleimage"
android:layout_height="150dp"
android:layout_width="150dp"
android:src="@drawable/circle">
</ImageView>
您可以使用此circle.xml一个或多个imageViews ...
You can use this circle.xml for one or more imageViews ...