How to create a circle drawable?

纵然是瞬间 提交于 2019-12-25 01:13:38

问题


How to a create a drawable of a circle, with blue stroke of 5 pixels and a transparent fill.

I will be passing this drawable to an ItemizedOverlay .

I want to do this with code and I will know the radius of the circle.


回答1:


Try something along the lines of:

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
       type="OvalShape" >
   <stroke android:width="5dp" android:color="#99104E8B"/>
   ....
</shape>

Just put something like this in an XML file in you drawables directory and load it as you would a normal image.

See ShapeDrawable in the Android Docs.



来源:https://stackoverflow.com/questions/6051818/how-to-create-a-circle-drawable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!