I'm using NestedScrollView in order to reach something similar to this.
This is my repo.
I figure out when the mobile turns to landscape the scroll don't let me visualize the buttons or the grey view at bottom.
This is my mainlayout.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.design.widget.AppBarLayout
android:id="@+id/appbarLayout"
android:layout_width="match_parent"
android:layout_height="256dp"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleTextAppearance="@style/Toolbar.TitleText"
app:collapsedTitleTextAppearance="@style/Toolbar.TitleText"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<ImageView
android:id="@+id/iv_tipo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:fitsSystemWindows="true"
android:layout_gravity="center"
app:layout_collapseMode="parallax"
app:srcCompat="@drawable/aviso_128dp"/>
<!--<include layout="@layout/toolbar_pin" />-->
<android.support.v7.widget.Toolbar
android:id="@+id/myToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />
<TextView
android:id="@+id/tv_toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- A CardView that contains a TextView -->
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
card_view:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/field_nombre"
layout="@layout/actividad_field" />
<include layout="@layout/actividad_separator" />
<include
android:id="@+id/field_direccion"
layout="@layout/actividad_field" />
<include layout="@layout/actividad_separator" />
<include
android:id="@+id/field_direccion2"
layout="@layout/actividad_field" />
<include layout="@layout/actividad_separator" />
<include
android:id="@+id/field_localidad"
layout="@layout/actividad_field" />
<include layout="@layout/actividad_separator" />
<include
android:id="@+id/field_provincia"
layout="@layout/actividad_field" />
<include layout="@layout/actividad_separator" />
<include
android:id="@+id/field_telefono"
layout="@layout/actividad_field" />
<include layout="@layout/actividad_separator" />
<include
android:id="@+id/field_email"
layout="@layout/actividad_field" />
<include layout="@layout/actividad_separator" />
<include
android:id="@+id/field_descripcion"
layout="@layout/actividad_field" />
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<Button
android:id="@+id/bt_productos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ver productos" />
<Button
android:id="@+id/bt_finalizar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Finalizar" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@color/gray"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
And the actividad_separator.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="0dp"/>
<View
android:layout_width="0dp"
android:layout_weight="8"
android:layout_height="1dp"
android:background="@color/divider"/>
<View
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="0dp"/>
</LinearLayout>
And the actividad_field.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="0dp"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="8"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_person_primary_36dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:id="@+id/tv_clave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textSize="10sp"
android:text="Clave" />
<TextView
android:id="@+id/tv_valor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textStyle="bold"
android:text="Valor"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="0dp"/>
</LinearLayout>
This is how looks like:
This is how it works (incomplete scrolling because I cant see the grey bar at the bottom):
setnestedscrollingenabled set it to false. try this one add property in recyclerview android:descendantFocusability="blocksDescendants" .
NestedScrollView is just like ScrollView , but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.
In order to float the outer, use NestedScrollView. floatHeaderSlivers. When set to true, the nested scrolling coordinator will prioritize floating in the header slivers before applying the remaining drag to the body.
Inside NestedScrollView
add android:paddingBottom="50dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="50dp"
android:orientation="vertical">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With