画出不同的看法多个形状 [英] Draw multiple shapes in different views

查看:126
本文介绍了画出不同的看法多个形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含两个图像视图中的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 ...

这篇关于画出不同的看法多个形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆