Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollable TextView in Android Widget

I would like to create an android widget with a scrollable textview.

The solutions given to this question Making TextView scrollable on Android cannot be applied because it is a widget:

1. This

 findViewById(R.id.textview).setMovementMethod(new MovementMethod());

does not work, since findViewById is not available in AppWidgetProvider but only in Activity.

2.Putting a ScrollView around the TextView also does not work, because I get an InflateException:

 android.view.InflateException: Binary XML file line #23: Error inflating class ScrollView

Can anybody give me a hint, how to make a TextView in a Widget scrollable?

like image 210
thomasd Avatar asked Aug 03 '26 01:08

thomasd


2 Answers

I solved this problem by putting the text view inside ListView with single node, which is supported in App widget.

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

like image 156
bat-el.g Avatar answered Aug 05 '26 18:08

bat-el.g


It looks like this is not possible.

More on this can be found here: http://code.google.com/p/android/issues/detail?id=9580

and here: How to make a scrollable app widget?

So, probably it is possible to do make appwidgets scrollable in the HTC sense environment but not for normal android environments.

A way around this is to add buttons that go up and down in a list.

like image 35
thomasd Avatar answered Aug 05 '26 19:08

thomasd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!