No, that wasn't the problem. I figured out what it was though. As you may know (or not know), the (x,y) coordinate system on the Android screen is a little different. The origin is in the top left corner, so therefore x increases across to the right and y increases down to the bottom.
So instead of: Java: RectF clockRect = new RectF(86, 314, 394, 6); It should have been: Java: RectF clockRect = new RectF(86, 6, 394, 314); It all makes sense now. On Feb 27, 12:07 am, Marco Nelissen <marc...@android.com> wrote: > Not sure if this is the cause of your problem, but the arguments to > the RectF constructor are supposed to be left, top, right, bottom, and > you seem to be specifying left, top, width, height instead. > > On Thu, Feb 26, 2009 at 11:48 AM, xspotlivin <dmbrown2...@gmail.com> wrote: > > > I'm trying to create a customized clock that will highlight certain > > intervals that I choose (like a pie slice). I'm trying to use the > >drawArccommand for the Canvas class. However, it will only draw arcs > > of 360 degrees or more (full circles). I'd like to draw arcs of about > > 15 to 20 degrees or so. I have no idea what is wrong with my code. Can > > anyone figure out the problem? I know it's not being drawn behind my > > background because it will draw the full circle on top (you can just > > remove the background line of code). I'd really appreciate you all > > help. My code for my Activity and View class is below: > > > Activity Class: > > > Code: > > 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; > > > /** 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 the application to full screen, > > and set the orientation 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); > > } > > } > > > And the ClockView Class: > > > Code: > > 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 amColor = new Paint(); > > > public ClockView(Context context) { > > super(context); > > > this.setBackgroundDrawable(getResources().getDrawable > > (R.drawable.clockbackground)); > > > this.amColor.setARGB(100, 248, 225, 110); > > } > > > @Override > > protected void onDraw(Canvas canvas) { > > > float startAngle = 0; > > float sweepAngle = 60; > > > RectF clockRect = new RectF(86, 314, 394, 6); > > canvas.drawArc(clockRect, startAngle, sweepAngle, true, > > this.amColor); > > } > > } > > > Thanks. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---