Give extra space at bottom of RecyclerView so the last item isn't covered by FAB

This commit is contained in:
Phillip Hsu 2016-08-30 17:02:37 -07:00
parent d970505dd5
commit a7af4f84bb
3 changed files with 18 additions and 3 deletions

View File

@ -51,10 +51,10 @@ public class TimersFragment extends RecyclerViewFragment<
int cardViewMargin = r.getDimensionPixelSize(R.dimen.cardview_margin);
switch (getOrientation(r)) {
case Configuration.ORIENTATION_LANDSCAPE:
list.setPaddingRelative(cardViewMargin/*start*/, cardViewMargin/*top*/, 0, 0);
list.setPaddingRelative(cardViewMargin/*start*/, cardViewMargin/*top*/, 0, list.getPaddingBottom());
break;
case Configuration.ORIENTATION_PORTRAIT:
list.setPaddingRelative(0, 0, 0, cardViewMargin);
// list.setPaddingRelative(0, 0, 0, cardViewMargin);
break;
}
return view;

View File

@ -1,7 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- clipToPadding specifies whether padding should cut into the
- view bounds, and hence into the children. To us, setting
- this to false has the effect of padding the bottom with
- extra space so the FAB isn't covering the last item
- when we scroll to it.
-
- An outsideOverlay scrollbarStyle means the scrollbar is drawn
- outside of the clipping boundary due to padding, and is laid over
- the RecyclerView, rather than being inside of its container (which
- mandates it being inset and adding to the view's padding).
-->
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"/>
android:scrollbars="vertical"
android:scrollbarStyle="outsideOverlay"
android:clipToPadding="false"
android:paddingBottom="@dimen/fab_total_height"/>

View File

@ -11,6 +11,7 @@
<dimen name="alarm_time_text_size">48sp</dimen>
<dimen name="app_bar_height">180dp</dimen>
<dimen name="text_margin">16dp</dimen>
<dimen name="fab_total_height">88dp</dimen>
<dimen name="grid_element_text_size">34sp</dimen>
<dimen name="grid_element_touch_target">40dp</dimen>