Android ScrollView question

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorAccent">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:background="@color/colorPrimaryDark"
        android:text=""
        android:textSize="70sp" />

</ScrollView>

clipboard.png

Mar.04,2022

actual width and height of scrollview in code ~ = (approximately equal to) screen width and height, verification method, the height of scrollview that can be output in Activity is actually about equal to screen height, not content height

then it also has content width and height, which is determined by the size of the content.
android:layout_gravity= "center" aligns the center of the TextView to the center of the scrollview, but not the content center of the scrollview

if you want to align the content center, it is recommended to wrap a LinearLayout or other ViewGroup
around the TextView

code



        <TextView
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@color/colorPrimaryDark"
            android:text=""
            android:textSize="70sp" />
    </LinearLayout>

</ScrollView>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5c8c9-44375.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5c8c9-44375.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?