I am a noob to android and I am trying to create a widget that uses textview marquee to displays tweets in a ticker fashion. When I set the text in the xml the marquee scrolls properly in the widget. However, when i attempt to set the text programmatically the marquee doesn't scroll. The text is set, but it just doesn't scroll. This behavior is baffling because i used this SO question as my guide. Any help is greatly appreciated.
My Layout
<TextView
android:id="@+id/ticker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:duplicateParentState="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:focusable="true"
android:focusableInTouchMode="true"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:text="Simple application that shows how to use marquee, with a long text for Twitter Feed" > //<--this text scrolls fine
<requestFocus
android:duplicateParentState="true"
android:focusable="true"
android:focusableInTouchMode="true" />
</TextView>
My Code
public static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) {
//String currentTime = df.format(new Date());
String spotgold = String.valueOf(MyActivity.widgetlivespotgold);
String spotsilver = String.valueOf(MyActivity.widgetlivespotsilver);
StringBuilder tickertweets=new StringBuilder();
for (int i = 0; i < MyActivity.twittername.size(); i++) {
tickertweets.append(MyActivity.twittername.get(i) + ":" + " " + MyActivityActivity.twittertweet.get(i) + " ");
}
RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.widget1);
updateViews.setTextViewText(R.id.goldspot, spotgold);
updateViews.setTextViewText(R.id.silverspot, spotsilver);
updateViews.setTextViewText(R.id.ticker, tickertweets.toString()); //Text is set, but doesn't scroll
appWidgetManager.updateAppWidget(appWidgetId, updateViews);
}