Monday, September 28, 2020

Linearlayout scrollbars = "vertical" is not useful, the solution to Linearlayout scrolling

The content of Linearlayout often exceeds the screen. Although the scrollbars=”vertical” parameter can be set, it is useless.

The correct approach is to nest a layer of ScrollView outside the LinearLayout.

<ScrollView xmlns:android=”http://schemas.android.com/apk/res/android”

    android:layout_width=”match_parent”

    android:layout_height=”match_parent”

    android:fadingEdge=”vertical”

    android:scrollbars=”vertical”>

    <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”

        android:layout_width=”match_parent”

        android:layout_height=”match_parent”

        android:orientation=”vertical”>

            android:layout_width=”match_parent”

            android:layout_height=”wrap_content”

            android:text="Please select a date:"

            android:textColor=”@android:color/holo_blue_dark”

            android:textSize=”22sp” />

No comments:

Post a Comment