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. how to exclude vssver2.scc from build?

subject line says it all

MS's VisualSourceSafe adds vssver2.scc files to folders that are
managed by VSS.

trying to build a project from Eclipse using the Android 2.0 SDK
produces errors on these files:

ERROR Error parsing XML: not well-formed (invalid token)
vssver2.scc  /MyApp/res/layout  line 1  Android AAPT Problem

how to I get aapt.exe(?) to ingore these files?

i have managed to get eclipse to hide them by using a java element
filter (on a very well hidden menu - thumbs up to that piece of design)


2. Unable to access remote DB2 database from Android Emulator

I need to access a remote DB2 Database table
from Android phone. Could you tell me the procedure to do it from the
Android Emulator?
It would be helpful if you could send me sample program to do it.


3. SDK 2.0 Traceview in The Droid.

4. The audacity !

5. Defining 'padding' through a style

6. Windows XP USB driver problems - DROID, Hero, Tattoo and more...

7. appwidget query