Friday, May 20, 2011

Re: [android-developers] Re: Why ImageView doesn't show up inside ScrollView

On Fri, May 20, 2011 at 12:47 PM, Frank <frank.android.liu@gmail.com> wrote:
> Before answering your question, can I ask does using
> LinearLayout.LayoutParams prevent it from working?

Quite possibly.

> I tried to comment
> it out, but it still doesn't work.

Just call addView() with the child View. Note that I have never tried
populating a ScrollView from Java (most people use XML).

> In fact, this is just a trial code. What I really want to do is to
> tile a ViewGroup with a whole bunch of ImageViews. I want to specify
> the absolute location and dimensions of each ImageView inside the
> parent ViewGroup. However, it looks to me that I cannot do this. I
> found there is AbsoluteLayout, but it is deprecated. So do you know of
> any option to achieve this?

Write your own ViewGroup.

Or, don't use widgets at all, and draw on the Canvas, the way 2D games do.

Bear in mind that there is a massive range of screen resolutions
(based on size/density), which is why AbsoluteLayout is deprecated, as
it does not lend itself to creating UIs that work well on everything
from a 3" phone to a 10" tablet to a 42" TV.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate