我有一条包含多行的长文本。我想将TextView
包裹在ScrollView
内,以便ScrollView
的边缘应用 TEMPORARY alpha渐变TextView
,因为用户滚动文字。褪色根本不会出现。
我故意为TextView
的高度设置一个较高的值,但它对此或WRAP_CONTENT
或甚至MATCH_PARENT
都不起作用。
<ScrollView android:layout_width="match_parent"
android:layout_height="300dp"
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="200dp">
<TextView
android:layout_width="match_parent"
android:layout_height="1000dp"
android:text="He has been involved with various online encyclopedia projects.[7]\nHe is the former editor-in-chief of Nupedia,[8] chief organizer (2001–02) of its successor, Wikipedia,[9] and founding editor-in-chief of Citizendium.[10]\nFrom his position at Nupedia, he assembled the process for article development.[11] Sanger proposed implementing a wiki, which led directly to the creation of Wikipedia.[12]\nInitially Wikipedia was a complementary project for Nupedia.[12]"
android:id="@+id/textView"
android:textSize="20sp"
android:textAlignment="gravity"
android:gravity="center_horizontal"/>
</ScrollView>
我所能做的就是删除ScrollView
并在TextView
上获得永久 alpha渐变