开发者

Android: SlidingDrawer ignores requestLayout()

开发者 https://www.devze.com 2023-03-29 03:25 出处:网络
It appears that SlidingDrawer ignores calls to requestLayout() and forceLayout(). I have a SlidingDrawer in the bottom of my layout. This SlidingDrawer has a simple layout set as its android:handle.

It appears that SlidingDrawer ignores calls to requestLayout() and forceLayout().

I have a SlidingDrawer in the bottom of my layout. This SlidingDrawer has a simple layout set as its android:handle. In this handle layout, there is an ImageView, and this image needs to change from time to time.

The problem is that the images for the ImageView 开发者_开发技巧are not all the same size, and I need the ImageView to report back the correct width on getWidth() calls. When I change the displayed image via setImageResource(), the image displayed is changed but the width returned is of the original image, not the new one.

Upon research I've noticed that even though changing the image implicitly calls requestLayout() on the ImageView, no subsequent calls to onLayout() are made. This is true to the entire hierarchy.

What I need is to cause a re-layout of the SlidingDrawer, but it ignores any requestLayout() and forceLayout() requests. How can I do that?

0

精彩评论

暂无评论...
验证码 换一张
取 消