Android Widget 中的可滚动 TextView

tho*_*asd 3 android textview android-widget scrollable android-appwidget

我想创建一个带有可滚动文本视图的 Android 小部件。

对于这个问题 Making TextView可滚动的Android的解决方案 不能应用,因为它是一个小部件:

1.这个

 findViewById(R.id.textview).setMovementMethod(new MovementMethod());
Run Code Online (Sandbox Code Playgroud)

不起作用,因为findViewById在 中不可用,AppWidgetProvider而仅在 中可用Activity

2.ScrollView放置aTextView也不起作用,因为我得到一个 InflateException

 android.view.InflateException: Binary XML file line #23: Error inflating class ScrollView
Run Code Online (Sandbox Code Playgroud)

有人可以给我一个提示,如何使TextViewWidget 中的 可以滚动吗?

bat*_*l.g 5

我通过将文本视图放入具有单个节点的 ListView 中解决了这个问题,这在 App 小部件中受支持。

http://developer.android.com/guide/topics/appwidgets/index.html#collections