多行TextView边缘渐变

时间:2014-01-09 08:01:27

标签: android textview scrollview fade

我有一条包含多行的长文本。我想将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渐变

enter image description here

0 个答案:

没有答案