开发者

Android's custom status bar notification bug?

I am trying to show a custom notification content on the status bar via Remote View. I am using fill_parent for both width and height, but there is always a small gap on the right side. What am I doing wrong here?

Please see the screen shot here: http://img684.imageshack.us/img684/2347/devicenq.png

Layout code (I also used LinearLayout):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:background="@color/solid_yellow"
              >
    <ImageView android:id="@+id/image"
              android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:layout_marginRight="10dp"
              android:src="@drawable/stat_sample"
              />
    <TextView android:id="@+id/text"
              android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:textColor="#000"
              android:text="Hello, this message is in a custom expanded view"
              />
</RelativeLayout>

And here is the code snippet:

Intent notificationIntent = new Intent开发者_如何学Python(this, MessengerService.class);
PendingIntent contentIntent = PendingIntent.getActivity(
    this, 0, notificationIntent, 0);

Notification notification = new Notification(R.drawable.stat_sample,
    "Hello", System.currentTimeMillis());

RemoteViews contentView = new RemoteViews(getPackageName(),
    R.layout.custom_notification_layout);

notification.contentView   = contentView;
notification.contentIntent = contentIntent;

mNM.notify(R.string.remote_service_started, notification);

I have been banging my head all day with this... Thank you.


You have a

 android:layout_marginRight="10dp"

and that's when this space on the right appears

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜