hi
in short: what could cause situation where LinearLayout.getWidth()
returns correct values and LinearLayout.getHeight() returns always 0?
in details:
In screen layout i want one custom widget to stretch over screen to
use all possible free space
<com.test.ScrolledPicture
android:id="@+id/ImageWave"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1"
/>
for testing this ScrolledPicture layout looks like this (it will
change in the future, but for now lets keep it simple)
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="@+id/SPImage"
android:layout_width="wrap_content"
android:layout_height="fill_parent" android:padding="0px">
</ImageView>
</merge>
ScrolledPicture extends LinearLayout
now inside my widgets class i try to find its dimensions (i need them
to create bitmap data into this embedded ImageView)
directly reported height and width are 0. this is expected
then i get call to overrided onSizeChanged - but new value appears
only for width. Width is changed to 320 (which is correct), but Height
remains 0. And it never changes to anything else
What should I do to get correct layout height? does it mean that
layout_weight ignored for some reason?
i found that if i fill ImageView with dummy bitmap in creator (width=1
height=screen height) then onSizeChanged will work - it will first
return size 320xscreen_height, then it will be called again with
320xreal_size. so i am using this as workaround temporarily. but what
would be real good solution?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en