How to scroll/move text within TextView on home screen widget ?

by Ravi » Fri, 23 Apr 2010 08:02:10 GMT

Sponsored Links
 Hi All,

I have created a widget to be displayed on android emulator's home
screen to display some long text. In my main.xml layout file i've
already set TextView properties like singleLine="true",
ellipsize="marquee", focusable="true" etc, but still when my widget is
displayed on home screen text does not move/scroll.

----------------- main.xml layout file ------------------------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" 
android:layout_height="wrap_content" android:background="@drawable/
<TextView android:id="@+id/widget_textview"
android:focusable="true" />

----------------- end of main.xml layout file ------------------------

------------- My file ----------------------


import android.util.Log;
import android.widget.RemoteViews;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;

public class WeatherWidget extends AppWidgetProvider{

private static final String TAG = "WeatherWidget";

public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[] appWidgetIds)
Log.d("WEATHER-WIDGET", "onUpdate(): ");

final int N = appWidgetIds.length;
// Perform this loop procedure for each App Widget that belongs to
this provider
for (int i=0; i<N; i++) {
int appWidgetId = appWidgetIds[i];

// Create an Intent to launch ExampleActivity
Intent intent = new Intent(context, Weather.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
intent, 0);

Log.i("WEATHER-WIDGET", " Create and Attach Text-view click handler
// Get the layout for the App Widget and attach an on-click listener
to the button
RemoteViews views = new RemoteViews(context.getPackageName(),
views.setOnClickPendingIntent( , pendingIntent);

// Tell the AppWidgetManager to perform an update on the current App
appWidgetManager.updateAppWidget(appWidgetId, views);

----------------- End of WidgetProvider file--------------------

When i add widget on home screen than only some part of text is
displayed as " Latest Weather Infor" but i would like to write the
code in such a way that the complete text should scroll till the
complete string/text is displayed.

Please suggest whether i need to change my layout file or what logic i
can write so that i can scroll the text.

Thanks in advance,


Other Threads

1. application to run first time device is turned on

Hi All,

I am writing an application that is intended to run only once, the
first time the user turns on their device.  We'll call it the "setup
wizard."  I wanted to know the proper way of doing this.

I saw the following Settings.System.SETUP_WIZARD_HAS_RUN, but could
not find anywhere in the SDK it is used to launch an application.

I am aware of the Intent, android.intent.action.BOOT_COMPLETED, and
could use it with Settings to launch my application.  I just wanted to
know if this is the proper way to run the "setup wizard."

Just to make sure I'm clear, I'm developing an application that will
come installed on a device, not an application the user will download
from the market place.

Thanks for any insights,



2. Ada yang bisa bantu Upgrade Radio dan Upgrade ROM di BANDUNG....Mau dong...

handsetnya apa?
mestinya kalo dibandung ada suhu besar 9AB
coba contact aja sama beliaunya. atau langsung ke gadtorade shop

salam igor

Ada yang bisa bantu Ugrade Radio dan Upgrade ROM ke Eclair 2.1....

lokasi di bandung....

mau dong mau dong....

ada yang bisa bantuin, plus bayarnya berapa nih???

pengen dong...

udh mentok bgt nih pusing ga ngerti....

ada yang bisa?

saya di bandung juga nih....

balesnya di sini aja,kalo di email suka ga kebaca..

ato sms ke


"Indonesian Android Community [id-android]"

3. I want to find source file which controls wifi signal icon on status bar.

4. Ups B M G ;Ask sw NMG

5. SmartPhone as TV channel

6. Intercepting incoming/outgoing email messages

7. Html with ArrayAdapter<CharSequence>