gpt4 book ai didi

android - RemoteServiceException : Bad notification posted. 无法扩展 RemoteViews:StatusBarNotification

转载 作者:行者123 更新时间:2023-11-30 00:30:00 27 4
gpt4 key购买 nike

我在 Android 中发出此类通知,但不知何故收到以下类型的异常。请帮我解决这个问题。我为 Root View 使用了 64dp 的高度,这是通知的自定义 View 。然后使用 notificationCompat 构建器中的 setContent 设置此自定义 View 。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginLeft="@dimen/marginBig"
android:layout_marginRight="@dimen/marginBig">

<ImageView
android:id="@+id/mg_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:src="@drawable/mg_round_image"/>

<TextView
android:id="@+id/mg_emergency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/mg_logo"
android:layout_toRightOf="@id/mg_logo"
android:text="@string/mg_emergency_card"
android:textAppearance="@style/P1.Medium.Vermillion"/>

<TextView
android:id="@+id/call_ambulance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/mg_emergency"
android:layout_alignParentRight="true"
android:layout_marginLeft="4dp"
android:layout_marginRight="@dimen/marginBig"
android:clickable="true"
android:text="@string/call_ambulance"
android:textAllCaps="true"
android:textAppearance="@style/P3.Bold.Vermillion"/>

<TextView
android:id="@+id/vertical_line"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/mg_logo"
android:layout_alignTop="@id/call_ambulance"
android:layout_toLeftOf="@id/call_ambulance"
android:background="@color/divider_line">
</TextView>

<TextView
android:id="@+id/emergency_contact_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/mg_emergency"
android:layout_below="@id/mg_emergency"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@id/vertical_line"
android:lines="2"
android:text="@string/my_emergency_contact"
android:textAppearance="@style/P2.Regular.Grey2"
tools:text="My Emergency Contact Manisha- 0987654321"/>

<TextView
android:id="@+id/horizontal_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/vertical_line"
android:background="@color/divider_line">
</TextView>

<TextView
android:id="@+id/send_alert_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/call_ambulance"
android:layout_below="@id/call_ambulance"
android:layout_marginTop="8dp"
android:clickable="true"
android:text="@string/send_alerts"
android:textAllCaps="true"
android:textAppearance="@style/P3.Bold.Primary"/>
</RelativeLayout>

最佳答案

这个问题的答案很愚蠢....我只是将 Root View (相对布局)的边距从 @dimen/marginBig 更改为硬代码(16dp)并且它工作正常。 @M_AWADI 在这篇文章中回答android - Bad notification posted - Couldn't expand RemoteViews for: StatusBarNotification帮助我实现了目标。

关于android - RemoteServiceException : Bad notification posted. 无法扩展 RemoteViews:StatusBarNotification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44604936/

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