Skip to content Skip to sidebar Skip to footer

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 w

Solution 1:

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

Solution 2:

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.

Solution 3:

I have been working on this with two buttons which increment and decrement through an array. Just having trouble accessing the global variables. Did you make any headway on this?

Solution 4:

Another solution is:

  • Add to textview any web link - for example: www.google.com.

  • Setting text value with HtmlCompat.fromHtml method:

    textView.setText(HtmlCompat.fromHtml("some text" + "\nwww.google.com", HtmlCompat.FROM_HTML_MODE_COMPACT));

After that vertical scrollbar is appeared. But it's not elegant and full solution. It's temporary workaround maybe...

The complete full solutiion is bat-el-g 's answer - with adding ListView.

Current marked solution (which just tell: "it's not possible") - is wrong.

Solution 5:

In mainactivity.java:

after code text view:

TextView txt = (TextView) findViewById(R.id.textView id);

Enter this code:

txt.setMovementMethod(newScrollingMovementMethod());

and you will be ok.

Post a Comment for "Scrollable Textview In Android Widget"