嗨我在我的应用程序中有我的自定义通知,在Android 2.2 2.3 4.0中工作完美,但在4.1.1果冻豆中没有尝试但我无法在我的自定义通知中使用marquee工作我的代码.xml:
<TextView
android:id="@+id/notification_title"
style="@style/NotificationTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="bottom"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="false"
android:singleLine="true"
android:textSize="20sp"
android:textStyle="bold" >
<requestFocus />
</TextView>
<TextView
android:id="@+id/notification_text"
style="@style/NotificationText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/notification_title"
android:layout_marginTop="3dp"
android:textSize="15sp" >
</TextView>
我的通知代码:
int NOTIFICATION_ID = 1;
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.notificacion;
long when = System.currentTimeMillis();
CharSequence tickerText = "Reproduciendo...";
Notification notification = new Notification(icon, tickerText,
when);
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.notification);
contentView.setTextViewText(R.id.notification_title, txtMetaTitle.getText().toString());
contentView.setTextViewText(R.id.notification_text, txtMetaUrl.getText().toString());
notification.contentView = contentView;
Intent notificationIntent = new Intent(AACPlayerActivity.this, Principal.class);
PendingIntent contentIntent = PendingIntent.getActivity(AACPlayerActivity.this, 0, notificationIntent, 0);
notification.contentIntent = contentIntent;
notification.flags |= Notification.FLAG_ONGOING_EVENT;
mNotificationManager.notify(NOTIFICATION_ID, notification);
}
我的应用程序运行良好但是大帐篷不开始不知道为什么在4.1.1?我该怎么做才能解决这个问题?
非常感谢你。答案 0 :(得分:1)
请注意:不建议在Notification
中构建通知,而是使用Builder
子类。另外,要获得跨平台的兼容性,您应该考虑使用android.support.v4.app.NotificationCompat
。你应该可以使用相同的RemoteViews
;尝试切换到新的方式,看看会发生什么。