Genymotion + Targeting Scrolling Tablet Layouts with CoordinatorLayout

SO, I am working on an application that has this hierarchy for a particular fragment of a part:

CoordinatorLayout AppBarLayout CollapsingToolbarLayout Toolbar NestedScrollView 

This is the setting:

  • CollapsingToolbarLayout has scrollFlags = "scroll | exitUntilCollapsed"
  • Toolbar with layout_collapseMode = "pin"
  • NestedScrollView has layout_behavior = "@ string / appbar_scrolling_view_behavior"

So, when the NestedScrollView user scrolls by the user, the ToolbarLayout will shrink until it is fully anti-aliased, but the toolbar will only shrink to the minimum height it is sent to, since it is set to output when minimized. I believe this is a fairly common UI / UX pattern. This is just a simple Master-Detail format.

With that said, on phones, my application should show the main fragment, followed by a fragment of the detail in the interaction. On tablets / Fabs, both the main and detailed fragments should be displayed side by side, so that the fragment of the part changes when interacting with the user in the main fragment. This is done using various structured layouts in the layout-sw600dp folder that I created.

Problem

The setup works fine on a physical phone, but there is a problem when testing the application on the Genymotion emulator for tablets / phones. Using the layout-sw600dp folder, I appropriately show two fragments side by side, but the scroll behavior no longer functions as expected. The NestedScrollView part snippet will scroll, but the CollapsingToolbarLayout will no longer be compressed, and the toolbar will not be compressed or locked in place. The entire CollapsingToolbarLayout just snaps into place, and the NestedScrollView will not scroll to show all the content below. Can someone explain why I see this behavior? The API level should not be a problem, so I'm lost. I checked the settings of the two panels on my physical phone running Android 5.1, and the scrolling behavior works as expected (but the content is very compressed, as expected!)

Another problem is that when I run this on the Genymotion phone emulators, it will show two panels with fragments side by side, although this should not ... The width / height of the phones for 4.1+ emulators is at least 768 x 1280, so they are used layout-sw600dp resources.

This was tested on: Android 4.4 / 5.1 Tablets with 2560x1600 sizes and Android 4.4 / 5.1 phones on the Genymotion emulator

+5
source share

Source: https://habr.com/ru/post/1236110/


All Articles