What if you try to add (and by "adding" I mean placing on top of it) an ImageView to another one ? Say you've already set the image in your layout xml file and later on you'd like place a smaller image somewhere on it in order it to be used as a button to click on.
Emre > Date: Thu, 30 Jul 2009 07:20:21 -0400 > From: mmur...@commonsware.com > To: android-developers@googlegroups.com > Subject: [android-developers] Re: Handling a layout ... > > > Emre A. Yavuz wrote: > > Sorry about the late response. > > > > Here's what I meant by the potential casting problem; > > > > In order to add the ImageView variable, which was created to handle the > > Drawable resource, you need to cast the parent layout, which is of type > > ImageView, to ViewGroup type if you're planning to use the addView() method. > > You cannot add an ImageView to an ImageView. ImageView is not a > container and, therefore, is not a ViewGroup. You can only add Views > (e.g., ImageView) to a ViewGroup (e.g., LinearLayout). > > However, I cannot imagine a GUI design that would require an ImageView > hold another ImageView. For example, if your goal is to replace an image > in an ImageView, you can just call setImageResource() on the ImageView > you already have, rather than try adding a new one. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Need Android talent? Ask on HADO! http://wiki.andmob.org/hado > > > _________________________________________________________________ More storage. Better anti-spam and antivirus protection. Hotmail makes it simple. http://go.microsoft.com/?linkid=9671357 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---