gpt4 book ai didi

Android 的自定义状态栏通知错误?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:40:54 27 4
gpt4 key购买 nike

我正在尝试通过 Remote View 在状态栏上显示自定义通知内容。我对宽度和高度都使用 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>

这是代码 fragment :

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);

我整天都在为这个问题苦思冥想……谢谢。

最佳答案

你有一个

 android:layout_marginRight="10dp"

然后就是右边这个空格出现的时候

关于Android 的自定义状态栏通知错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5053787/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com