用清扫机器人弧圈绘制 [英] android drawable circle with a sweeping arc

查看:317
本文介绍了用清扫机器人弧圈绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想画一个类似于进度条。然而,在我的情况,进度条如下图所示,不同颜色的清扫弧圆(图2显示了由黄色表示一些进展,设计的快照)。一旦任务完成,整个圆将变成黄色。

I am trying to draw something akin to a progress bar. However, in my case, the progress bar is a circle with a sweeping arc of a different color as shown below (Figure 2 shows a snapshot of the design with some progress indicated by the yellow color). Once the job is complete, the entire circle would become yellow.

为使这一点,我想用XML布局来创建一个圆,我能够做到这一点与下面code:

To make this I would like to create a circle using xml layout and I am able to do that with following code:

在RES /绘制/ circle.xml

In res/drawable/circle.xml


<solid android:color="@color/red" />

<size
    android:height="200dp"
    android:width="200dp" />

<padding
    android:bottom="10dp"
    android:left="10dp"
    android:right="10dp"
    android:top="10dp" />

在我主要布局我只设置这个为背景,以一个...的FrameLayout
    
    

In my main layout I just set this as a background to a framelayout...

   <FrameLayout
       android:id="@+id/frameLayout"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:background="@drawable/circle" >

   </FrameLayout>

</LinearLayout>

我知道如何用在<一个在Android的演示code给出的例子来绘制圆弧href=\"http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Arcs.html\" rel=\"nofollow\">http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Arcs.html

我就如何将这两个结合起来,创造一个清扫运动挣扎了一下。我知道我们必须创建一个线程,并创建一个的onDraw像在演示 - 但我怎么设置扫地圆弧中心是在绘制圆的中心?而如何将java的code模样(在活动)?感谢名单!

I am struggling a bit on how to combine these two to create a sweeping motion. I know we have to create a thread and create an onDraw like the one in the demo - but how do I set the sweeping arc center to be at the drawn circle's center? And how would the java code look like (in the activity)? Thanx!

推荐答案

而不是使用形状一旦通过这个链接,创建循环。

Instead of creating circle using shape once go through this link.

的http://$c$c.google.com/p/afreechart/

我希望它可以帮助你。

这篇关于用清扫机器人弧圈绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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