开发者

Open Percentage of SlidingDrawer in Android

I am trying to determine the "open" percentage of a SlidingDrawer in Android. It seems that the drawer only has onOpen, onClose and onScroll Listeners. OnScroll only provides methods for determining when scroll has ended and when scroll has begun.

TouchEvents won't work either because the SlidingDrawer can 开发者_Go百科slide without being touched...

I tried grabbing the Animation of the SlidingDrawer using getAnimation() (and then somehow determining percentage based on that) but that returns null and so does getLayoutAnimation().

Any thoughts?


Very late answer, and I'm sure you don't care anymore, but someone else might. :)

I'm not entirely sure why you want a sliding drawer at all. It is likely easier and faster to write your own custom view that allows you to slide in and out, than to try to use sliding drawer. That way you will have way more control.

Another thought is to try getting the visible child rectangle of the sliding drawer from its container using getChildVisibleRect, and calculate the visible percentage using getWidth on the drawer. I'm not at all sure this will work. :)

Best of luck either way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜