[英]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. 我在宽度和高度都使用fill_parent,但右侧总是有一个小间隙。 What am I doing wrong here? 我在这做错了什么?
Please see the screen shot here: http://img684.imageshack.us/img684/2347/devicenq.png 请看这里的屏幕截图: http : //img684.imageshack.us/img684/2347/devicenq.png
Layout code (I also used LinearLayout): 布局代码(我也使用了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(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 那就是右边这个空间出现的时候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.