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