Reputation: 300
I use a SlidingUpPanelLayout in my app. (Thanks umano it's a very handy library)
I have added a parallax image (with a width equal to the width of the screen) that behaves in a way similar to Google maps, i.e the image is hidden underneath the panel when the panel is collapsed, and the image moves up as the panel gets expanded, until the image is at the top of the screen with the panel just under it. At this stage, the panel reaches its anchor point (I calculate dynamically the value of the anchor point, it has a value of about 0.6 in portrait).
When I rotate the image, I recalculate the anchor point. (in onLayoutChange) In landscape the image has got the same size but it has some padding on the sides to fill the void (the anchor point has a value of about 0.4 in landscape)
The problem is that the when I rotate the device, the drawer does not go to the new anchor point unless I touch the panel. I have to programmatically close and reopen the drawer for it to go to the new updated anchor.
Has anyone else experienced the same problem, or managed to get the drawer to move to a particular position programmatically?
TIA
Upvotes: 0
Views: 503
Reputation: 540
It will be more correct and way easier to have different layout xml files for each orientation.
Read more here: https://developer.android.com/guide/practices/screens_support.html
Upvotes: 0