如何在android Eclipse中复制一个圆圈? [英] How do I duplicate a circle in android Eclipse?

查看:90
本文介绍了如何在android Eclipse中复制一个圆圈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何才能在应用程序的屏幕上显示一个圆圈,然后将其中的一个圆圈放在一起。在我的应用程序中,圆圈向下移动,所以我也想知道如何使圆圈出现在应用程序宽度的随机点上。



提前谢谢,< br $>


Collin Napier

Citrus Works

解决方案

查看2D绘图部分对此: android-tutorial [ ^ ]


您可以创建一个圆形实例并在画布上多次绘制它。例如,您有一个自定义视图,因此您可以覆盖方法

 protected void onDraw(Canvas canvas)

。 Canvas可以通过

绘制一个圆圈public void drawCircle(float cx,float cy,float radius,Paint paint)



你可以参考

http://developer.android.com /reference/android/view/View.html#onDraw(android.graphics.Canvas)

http://developer.android.com/reference/android/graphics/Canvas.html#drawCircle(float,float,float, android.graphics.Paint)


How would I go about making a circle appear on the app's screen and make multiply ones of it. In my app the circle is moving down so I also want to know how to make the circle appear at a random point along the apps width.

Thanks in advance,

Collin Napier
Citrus Works

解决方案

Check out the 2D Drawing section on this: android-tutorial[^]


You can create a circle instance and draw it multiple times on canvas. For example, you have a custom view, so you can override the method

protected void onDraw (Canvas canvas)

. Canvas can draw a circle via

public void drawCircle (float cx, float cy, float radius, Paint paint)

.
You can refer to
http://developer.android.com/reference/android/view/View.html#onDraw(android.graphics.Canvas)
http://developer.android.com/reference/android/graphics/Canvas.html#drawCircle(float, float, float, android.graphics.Paint)


这篇关于如何在android Eclipse中复制一个圆圈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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