Reputation: 17119
Is there a way to make a TextView
in a custom Notification
layout look like a ticker? I'm using the following code to set Notification
layout.
mNotificaionView = new RemoteViews(getPackageName(), R.layout.status_bar);
mNotificaionView.setTextViewText(R.id.ticker, getLongText());
mNotification.contentView = mNotificaionView;
And the following attrs for TextView
in status_bar.xml
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
In fewer words, how do I create a ticker like TextView
in a RemoteViews
object?
Upvotes: 0
Views: 2051
Reputation: 3064
Look at Any.DO SmallWidget(4x1).
It's a ticker that fades text in and out. And it's an AppWidget. How does it work?
The problem - battery consumption. All those alarms don't do well with the battery, but test it to see how bad is it first.
I never tried this on a notification bar widget, but since they are built with the same technique, this might work.
Good luck!
Upvotes: 1
Reputation: 1021
This should work, but only while your View has focus. See this answer, it may help you. Android notification Marquee not working
Upvotes: 1