1
我試圖爲簡單的HorizontalScrollView添加淡化邊緣。有關fadingEdge屬性的文檔:HorizontalScrollView fadingEdge
此屬性已被棄用,並將在API級別14(ICE_CREAM_SANDWICH)時被忽略。使用漸變邊緣可能會引入明顯的性能下降,並且只能在應用程序的視覺設計需要時使用。要請求API等級14及以上的衰落邊緣,請改用android:requiresFadingEdge屬性。
好的,但這種佈局不顯示任何衰落的邊緣,太:
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:requiresFadingEdge="horizontal"
android:fadingEdgeLength="50dp"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
...
</LinearLayout>
</HorizontalScrollView>
我缺少什麼?
overScroll和fadingEdges是不同的東西 – Ekz
你說得對,我的壞。我在這裏測試了你的佈局,它正在工作。也許還有別的東西會導致你的衰落邊緣不能顯示。 – caioyassoyama
其實這是一個老問題。我還沒有找到答案,並解決了我加入到'HorizontalScrollView'的onDraw()方法的問題,我自己實現了衰落邊緣。像魅力一樣工作。 – Ekz