如何添加垂直线为远程视窗定制的Android通知? [英] How to add vertical line to RemoteView for custom Android Notifications?
问题描述
我挣扎垂直线添加到自定义Android通知。我试着将这样的观点我相对布局:
I'm struggling to add a vertical line to a custom Android Notification. I've tried adding a view like this to my Relative Layout:
<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" />
但是,当我火了通知,我得到以下异常:结果
android.app.RemoteServiceException:从包装贴XXX坏通知:无法扩大RemoteViews:StatusBarNotification(包= XXX)
But when I fire the notification, I get the following Exception:
android.app.RemoteServiceException: Bad notification posted from package XXX: Couldn't expand RemoteViews for: StatusBarNotification(package=XXX)
任何人有什么想法?
推荐答案
您不能夸大在远程视窗
是任何看法。更改查看
来一个空的的TextView
或的ImageView
。
You can't inflate just any view in a RemoteView
. Change your View
to an empty TextView
or ImageView
.
一个RemoteViews对象(,因此,应用程序的Widget),可以支持以下布局类:
A RemoteViews object (and, consequently, an App Widget) can support the following layout classes:
FrameLayout
LinearLayout
RelativeLayout
和下面的小部件类:
AnalogClock
Button
Chronometer
ImageButton
ImageView
ProgressBar
TextView
ViewFlipper
ListView
GridView
StackView
AdapterViewFlipper
这些类的后代不被支持。
Descendants of these classes are not supported.
参考:的http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
这篇关于如何添加垂直线为远程视窗定制的Android通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!