Tak*_*aga 6 notifications android statusbar
我试图通过远程视图在状态栏上显示自定义通知内容.我在宽度和高度都使用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>
Run Code Online (Sandbox Code Playgroud)
这是代码片段:
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);
Run Code Online (Sandbox Code Playgroud)
我整天都在用这个敲打我的头......谢谢.
| 归档时间: |
|
| 查看次数: |
1705 次 |
| 最近记录: |