I have some problems with the scroll in the following view
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:isScrollContainer="true">
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainGrid"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="3"
android:layout_margin="0dp"
android:orientation="horizontal"
android:layout_marginBottom="4dp">
<!-- Card number block start -->
<TextView
android:layout_columnSpan="2"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:hint="Card number"/>
<!-- Card number block end -->
<!-- same other blocks -->
<!-- Contact list block start -->
<GridView
android:layout_columnSpan="3"
android:id="@+id/tableContacts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill"
tools:ignore="MissingConstraints"
app:layout_constraintTop_toBottomOf="@+id/btnAddNewContact"/>
<!-- Contact list block end -->
</GridLayout>
</android.support.constraint.ConstraintLayout>
If there is a long contact list, then the view is not scrollable. If I insert GridLayout
inside ScrollView
, then GridView
is collapsed to one line and an inner scroll is added.
android:isScrollContainer="true"
didn't help.
I just have no options for how to add scrolling so that GridView
doesn’t collapsing