How can I draw a simple shape with shapedrawable?

by Breezy » Wed, 10 Feb 2010 08:29:09 GMT


Sponsored Links
 I've looked for a tutorial on it, but I can't figure out how to do
it...  For starters, and I can dig some more from there, how do I have
a simple program draw a simple rectangle?  Nothing else, no frills,
just draw and display a rectangle?

I was thinking for the layout I would use ImageView, then use
ShapeDrawable from there, but I'm not so sure if that's correct.

--



How can I draw a simple shape with shapedrawable?

by Breezy » Wed, 10 Feb 2010 08:48:00 GMT


 Hmmm, still a little confused...  Are you saying to utilize the
ImageView, but draw on it as if it were a canvas?

On Feb 9, 6:31pm, Jason Proctor <jason.android.li...@gmail.com>


> >


Sponsored Links


How can I draw a simple shape with shapedrawable?

by schwiz » Wed, 10 Feb 2010 09:02:56 GMT


 You make your own class that inherits from View and in the onDraw
method you call canvas.drawCircle, drawLine, drawPath, etc






> > >



How can I draw a simple shape with shapedrawable?

by Breezy » Wed, 10 Feb 2010 10:56:31 GMT


 Okay, I see what you're talking about, but I guess my question is how
do I put that into my ImageView that's in my XML file?





> > > >



How can I draw a simple shape with shapedrawable?

by schwiz » Wed, 10 Feb 2010 13:06:26 GMT


 You need to override the constructor that has the attributes argument,
and then you just treat it like any other view in the xml file.  like
<your.package.here.customshape android:layout_width="100dip" etc />






> > > > >



Other Threads

1. How do you get the local time zone?

Hi,

I can't figure out how to get the local time zone...

TimeZone.getDefault() returns Pacific Time, while my phone's settings
show the time zone correctly set to EST.

Thanks
-Ben
--~--~---------~--~----~------------~-------~--~----~

2. TERRIBLE BUG IN MARKET APPLICATION (was Paid apps related questions discussion list?)

That is, while I care about bad ratings (people are giving 1 star when
they have any of the problems in my previous post) I care more about
frustrated users CANCELLING their orders because of these issues. I
was JUST about to have 1 cancel because of the update problems (in
this case the "Force Close" dialog problem).








--~--~---------~--~----~------------~-------~--~----~

3. TERRIBLE BUG IN MARKET APPLICATION (was Paid apps related questions discussion list?)

4. Activity.onRetainNonConfigurationInstance() called after onStop() and onPause() - too late to be relevant?

5. replacing open core

6. Map 3D View

7. remote service process persists (i.e. won't disappear from process table)