Kar*_*ela 3 android view android-layout android-notifications remoteview
我正在努力为自定义Android通知添加垂直线.我已经尝试将这样的视图添加到我的相对布局中:
<View
android:id="@+id/line_vertical"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/image_logo"
android:background="#0000FF" />
Run Code Online (Sandbox Code Playgroud)
但是当我触发通知时,我得到以下异常:
android.app.RemoteServiceException:从包XXX发布的错误通知:无法展开RemoteViews:StatusBarNotification(package = XXX)
有人有什么想法吗?
你不能只夸大任何一个视图RemoteView
.将您View
改为空TextView
或ImageView
.
RemoteViews对象(以及App Widget)可以支持以下布局类:
Run Code Online (Sandbox Code Playgroud)FrameLayout LinearLayout RelativeLayout
以下小部件类:
Run Code Online (Sandbox Code Playgroud)AnalogClock Button Chronometer ImageButton ImageView ProgressBar TextView ViewFlipper ListView GridView StackView AdapterViewFlipper
不支持这些类的后代.
参考:http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout