我正尝试通过远程视图在状态栏上显示自定义通知内容。我在宽度和高度都使用fill_parent,但右侧总是有一个小间隙。我在这里做错了什么?
请参见此处的屏幕截图:http://img684.imageshack.us/img684/2347/devicenq.png
布局代码(我也使用了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>
以下是代码段:
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);
我整天都在用这个敲打我的脑袋...... 谢谢。
答案 0 :(得分:1)
你有一个
android:layout_marginRight="10dp"
就在右边这个空间出现的时候