0
我試圖顯示一個通知與自定義視圖裏面有一個DigitalClock。服務崩潰開始。這裏是我的代碼:Android:數字時鐘在通知前景服務
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content">
<DigitalClock
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/myClock"
android:textSize="75dp"
android:layout_alignParentRight="true"
android:gravity="center_horizontal" />
</LinearLayout>
在我的服務:
RemoteViews mViews = new RemoteViews(this.getPackageName(), R.layout.clock_layout);
Notification notification = new Notification();
notification.when = 0;
notification.icon = R.drawable.ic_launcher;
notification.contentView = mViews;
notification.priority = 500;
notification.flags = notification.FLAG_ONGOING_EVENT;
notification.flags = Notification.FLAG_NO_CLEAR;
startForeground(2366, notification);
什麼建議嗎?