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. Please assist with sensors.

Hello,
i am in dire need of some assistance.
Assume the device is held in landscape position, the display facing to
the user, what i'd like to detect is if the device is rotated clock
wise or counter clock wise.
Sounds pretty simple, but i am trying for two days now without
success.
Could you please teach me how to archive it.

Thanks in advance,
Mike

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

2. How to make andorid plugin does not start everything I launch eclipse

what you are seeing is the android java specific builder kick in to
rebuild projects in the workspace..

Fred Grott
http://mobilbytes.wordpress.com





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

3. Emulator taking More time to open main page

4. HTML5 Schedule

5. How to make andorid plugin does not start everything I launch eclipse

6. cant zoom , or set traffic view in map

7. Can I put a custom view in a alert dialog box?