I'm trying to create a customized clock that given certain input will
highlight a certain section of the clock (e.g. draw pie shapes
highlights on top of the clock).

Here's my problem:

I'm trying to use drawArc in the Canvas class. I am able to draw 360
degree arcs, but nothing shows up when I draw any arcs less than 360
degree. I'd like to draw around 15 degree arcs, but when I put 15 into
the sweep angle location, nothing gets drawn. It only draws full
circles (360). Does anyone know what's wrong? Below is my code.

ACTIVITY CLASS:

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class AdherenceClock extends Activity {

       private ClockView clockView = null;
       public Document xml = null;

   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);

       this.clockView = new ClockView(this);

       //Remove the title bar, set to full screen, and set to
landscrape
       this.requestWindowFeature(Window.FEATURE_NO_TITLE);
       this.getWindow().setFlags
(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                       WindowManager.LayoutParams.FLAG_FULLSCREEN);
       setRequestedOrientation
(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

       setContentView(this.clockView);
   }
}

CLOCKVIEW CLASS:

package nmm.android.adherenceclock;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.View;

public class ClockView extends View {

       protected final Paint pmColor = new Paint();
       protected final Paint amColor = new Paint();

       public ClockView(Context context) {
               super(context);

 this.setBackgroundDrawable(getResources().getDrawable
(R.drawable.clockbackground));

               this.amColor.setARGB(100, 248, 225, 110);
               this.pmColor.setARGB(100, 111, 162, 214);
       }

       @Override
       protected void onDraw(Canvas canvas) {

               RectF clockRect = new RectF(86, 314, 394, 6);
               canvas.drawArc(clockRect, 0, 20, true, this.amColor);
       }
}


This doesn't work. It only works for 360 degrees. What's wrong?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to