我有一个TextView与ScrollView不匹配的问题...

这是我的代码:

<ScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/scrollViewSlide"
            tools:ignore="UselessParent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center">

                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp"
                    android:layout_gravity="center_vertical|center_horizontal"
                    android:id="@+id/txtPassage"
                    android:textAlignment="center"
                    android:textIsSelectable="true"
                    android:textColor="#ffffff"
                    android:textSize="15sp"
                    tools:ignore="UnusedAttribute" />

            </LinearLayout>

        </ScrollView>


显示并为假的s.th(最好这样说,大约5条第一行被隐藏了)android - TextView不适合ScrollView-LMLPHP

最佳答案

尝试这个

    <ScrollView
    android:layout_width="match_parent"
    android:fillViewport="true"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/li1"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:text="Hellofgbjfdkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkhbhbghbuuuuuuuuuuuuuuuubfiiiiiiiiiibigyygfjjjjjjjjjjjjjjjjjjjjjjjjjj\nfjgggggggggggggggg\ngfggggggggggggggggggg\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\njgjijhijghijgfhjgfhjigfjhijgfhjgi
            jfdjgkfjd\nkkgkfgklfkgfg"
            android:layout_height="match_parent" />
    </LinearLayout>

</ScrollView>

09-27 18:15