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. Multipart Messages - Is there an example how to get them work now. (Uploading to a web API)

On Mon, Aug 18, 2008 at 1:06 PM, code_android_festival_way <




That's surprising. It's common knowledge that multi part mime is necessary
in mobile, due to the performance gains and user experience in getting
complete pages of info. Guess you will need to parse the boundaries
yourself.

Shane

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

2. Is it possible to set different heights for every listitems in a listview?

I wanna to have a list view in which height of list items is not same.
Is there a way to do it?
I created a list view, wanna to get every list items and change their
heights, but can't list items from list view. not mention to change
their heights.
Is there anybody could help on this?

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

3. is there any one using XML to Java binding in Android?

4. Uploading a file to Google Groups...

5. Is there a way to find out a list of activities that are installed on android

6. Themes for Android?

7. to play audio when a button is clicked