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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM