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>

 

posted @ 2019-06-30 09:46  sebastia  阅读(1328)  评论(0编辑  收藏  举报