我有一個TextView,它的高度是動態的。我想設置最後一行不可見,如果它不能完全繪製。 screenshotTextView最後一行畫成兩半
高度動態的原因是它在AppWidget中使用,並且appwidget在不同設備上的大小不一樣。因此,您無法測量TextView,也無法使用TextView的子類。 link
這就是我現在基本使用的。當我把一個長文本放到TextView中時,最後一行看起來很難看。
<LinearLayout
android:id="@+id/widgetContent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/sg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
安置自己的TextView代碼once..so,我們可以做一些事情。 – Udaykiran
如果你不在AppWidget中,它很好。有一個示例應用程序[Wiktinary](http://developer.android.com/resources/samples/Wiktionary/index.html)。它在那裏使用android:fadingEdge =「vertical」。它不是最好的,但我想即將使用它。 – jakk