0

I've created fragment that is shown by reside menu (https://github.com/SpecialCyCi/AndroidResideMenu) as content for some menu item. The problem is that on Android 5+ height of ExpandableListView (green frame) is not measured correctly it cuts off bottom strip (approximately height) of system navigation buttons that are below. Looks like scroll frame is under those buttons and I can't scroll to show this part.

Incorrectly measured ExpandableListView

Now. After many tries I got the views to be almost correctly measured. I've added in onCreateView of my fragment:

if(Build.VERSION.SDK_INT >= 21) {
    view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}

ExpandableListView doesn't go under system buttons, but I have blank space on the top of view. Unfortunately this blank space stays there even if I switch menu item.

Can anyone share ideas what might be wrong?

Blank space on the top

Fishman
  • 1,737
  • 1
  • 25
  • 42
  • For what possible reason this is downvoted, without providing comment?! – Fishman Mar 20 '15 at 16:41
  • can u provide demo code for reside menu as expandable list view, i have posted this question also http://stackoverflow.com/questions/37154021/reside-menu-as-expandable-listview?noredirect=1#comment61845159_37154021 – Shankar BS May 11 '16 at 06:57
  • @Shan I am using reside menu as normal list. Here expandable list only coexists with menu (on screenshots hidden) – Fishman May 11 '16 at 08:02
  • okay thanks for the feedback .. :) can u suggest how to make expandable reside menu instead of normal list view – Shankar BS May 11 '16 at 08:15

2 Answers2

0

I have encountered this problem too. (Android ResideMenu library, bottom of Fragment has Cropping issue) As you said View height incorrectly measured on Lollipop devices. I found partial solution for it. While I'm trying to give transparency to the native navigation bar, I set android:windowTranslucentNavigation true in my values-v21 folder. Then View height started to calculate correctly, but color of the navigation bar has changed.

<resources>
        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
            <!-- Customize your theme here. -->
            <item name="android:actionBarStyle">@style/Widget.AppCompat.ActionBar</item>

     <item name="android:windowTranslucentNavigation">true</item>

        </style>
</resources>
Community
  • 1
  • 1
Orcun Sevsay
  • 1,310
  • 1
  • 14
  • 44
0

Hi there after around one week of work I found the perfect solution.

Main Activity

protected void onCreate(Bundle savedInstanceState)

{
etWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
mToolbar = (Toolbar) findViewById(R.id.toolbar);

((LinearLayout.LayoutParams)

mToolbar.getLayoutParams()).setMargins(0, getStatusBarHeight(this), 0, 0);

}

public static int getStatusBarHeight(Context context) {
    int result = 0;
    int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        result = context.getResources().getDimensionPixelSize(resourceId);
    }
    return result;
}

AndroidManifest activity add this line

<activity
            android:name=".activity.Main"
            android:configChanges="orientation|screenSize"
             android:windowSoftInputMode="adjustPan"
             android:fitsSystemWindows="true"
               android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

styleV21

<style name="myTheme" parent="FridayfairTheme.Base">
      <item name="android:windowTranslucentNavigation">true</item>
</style>
Ra'ad
  • 11
  • 2