Android:SlidingDrawer 忽略 requestLayout()
看来 SlidingDrawer 忽略了对 requestLayout() 和 forceLayout() 的调用。
我的布局底部有一个 SlidingDrawer。这个 SlidingDrawer 有一个简单的布局设置作为它的 android:handle。在这个句柄布局中,有一个ImageView,这个图像需要时时改变。
问题是 ImageView 的图像大小并不相同,我需要 ImageView 在 getWidth() 调用时报告正确的宽度。当我通过 setImageResource() 更改显示的图像时,显示的图像发生了更改,但返回的宽度是原始图像的宽度,而不是新图像的宽度。
经过研究,我注意到即使更改图像隐式调用 ImageView 上的 requestLayout(),也不会进行后续的 onLayout() 调用。这对于整个层次结构都是如此。
我需要的是重新布局 SlidingDrawer,但它会忽略任何 requestLayout() 和 forceLayout() 请求。我怎样才能做到这一点?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论