How to add vertical line to RemoteView for custom notifications on Android?

I am trying to add a vertical line to an Android custom notification. I tried adding such a view 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" />

But when I run the notification, I get the following exception:
android.app.RemoteServiceException: invalid notification sent from package XXX: failed to deploy RemoteViews for: StatusBarNotification (package = XXX)

Does anyone have any ideas?

+3
source share
2 answers

You cannot inflate just any performance in RemoteView. Change Viewto empty TextViewor ImageView.

RemoteViews (, , App) :

FrameLayout
LinearLayout
RelativeLayout

:

AnalogClock
Button
Chronometer
ImageButton
ImageView
ProgressBar
TextView
ViewFlipper
ListView
GridView
StackView
AdapterViewFlipper

.

: http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout

+6
    <LinearLayout
        android:layout_width="1dp"
        android:layout_height="25dp"
        android:layout_gravity="center_vertical"
        android:alpha="0.3"
        android:background="#FFFFFF" />

:

+1

All Articles