I would like to be able to do a NestedScrollView
adapted to versions before Lollipop (API 21)
and I am trying to follow the following tutorial:
but I still can not scroll in the text, I use a very simple framework and it does not give problems if I use the setNestedScrollView
method for Lollipop or higher:
Below I leave my code so that my error can be corrected:
-------- > item_image_parallax2.xml
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="@dimen/cardview_default_radius"
card_view:cardElevation="@dimen/cardview_default_elevation"
card_view:cardUseCompatPadding="true">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.v4.widget.NestedScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="12dp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="24dp">
<com.bluejamesbond.text.DocumentView
android:id="@+id/dv"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_gravity="center"
android:scrollbarStyle="insideInset"
android:textAppearance="@style/TextAppearance.AppCompat.Body1">
</com.bluejamesbond.text.DocumentView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</ScrollView>
</android.support.v7.widget.CardView>
</FrameLayout>
Let's say that the xml above I use in a joint Viewgroup to another XML that I leave below:
------------------ > header.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:focusableInTouchMode="false"
android:drawSelectorOnTop="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listViewId"
android:fastScrollEnabled="true"
android:scrollbarStyle="outsideOverlay" />
</LinearLayout>
I use the following code in the activity (extends from AppCompatActivity):
LayoutInflater inflater = getLayoutInflater();
ViewGroup header = (ViewGroup) inflater.inflate(R.layout.item_image_parallax2, list, false);
image = (ImageView) header.findViewById(R.id.image);
list.addHeaderView(header, null, false);