Android 布局中 ScrollView 内的 TextView 最后一行被遮住的解决办法

很简单,不要在 ScrollView 内部直接使用 TextView,而是在中间加一层 LinearLayout,就可以完美解决。

   <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="15dp"
        android:layout_weight="1"
        android:background="@drawable/password_input_text_bg"
        app:layout_constraintBottom_toTopOf="@id/bottom"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_weight="1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:id="@+id/console"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginVertical="15dp"
                app:layout_constraintBottom_toTopOf="@id/bottom" />
        </LinearLayout>

    </ScrollView>

猜你喜欢

转载自www.cnblogs.com/memoryLost/p/11108756.html
今日推荐