嗨,我的应用程序中有我的自定义通知,在 android 2.2 2.3 4.0 中完美运行,但在 4.1.1 jelly bean 中我试过但我无法在我的自定义通知中使用选框,这是我的代码 .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 中?我能做些什么来解决这个问题?
非常感谢您。