안 드 로 이 드 상주 알림 표시 줄 에서 발생 하 는 문제 및 해결 방법 실현
어쨌든 알림 이 표시 되 지 않 습 니 다.로 그 를 보 니 잘못된 것 같 습 니 다.
2020-06-28 14:11:34.923 6387-6387/xxx E/CrashReport: android.app.RemoteServiceException: Bad notification posted from package xxx: Couldn't inflate contentViewsandroid.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1944)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.app.ActivityThread.main(ActivityThread.java:6815)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:818)
레이아웃 이 잘못 되 었 다 는 것 을 말 합 니 다.사용 하 는 레이아웃 은 다음 과 같 습 니 다.
잘못된 정 보 를 보고 한 것 을 보면 바로 이것 이다.
android.support.constraint.ConstraintLayout
라 는 질문 을 던 졌 다.
그리고 레이아웃 의 루트 view 를 Relative Layout 로 변경 합 니 다.
운행,오류,,,나 니?
2020-06-28 14:24:02.622 11436-11436/xxx E/CrashReport: android.app.RemoteServiceException: Bad notification posted from package xxx: Couldn't inflate contentViewsandroid.view.InflateException: Binary XML file line #2: Binary XML file line #2: You must supply a layout_height attribute.
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1944)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.app.ActivityThread.main(ActivityThread.java:6815)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:818)
계속 잘못 을 보 고 했 지만 첫 번 째 잘못 과 달리 첫 번 째 잘못 보고 문제 가 해결 되 었 음 을 설명 했다.
그럼 두 번 째 오류 메 시 지 를 살 펴 보 겠 습 니 다.
Binary XML file line #2: You must supply a layout_height attribute.
정 보 를 보면 레이아웃 에 layot 가 부족 하 다 는 거 예요.height 속성,하지만 레이아웃 에 이 속성 이 설정 되 어 있 는 지 확인 하 세 요...
<?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"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_74"
android:background="@drawable/shape_bg_resident_notify">
<ImageView
android:id="@+id/iv_resident_weather"
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"
android:layout_marginStart="@dimen/dp_10"
android:background="@mipmap/weather_icon_blue_big_cloudy"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/tv_resident_weather_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="28"
android:textSize="@dimen/sp_40"
android:textColor="#ff333333"
android:layout_toEndOf="@+id/iv_resident_weather"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_5"/>
<TextView
android:id="@+id/tv_resident_degree"
android:layout_width="@dimen/dp_6"
android:layout_height="@dimen/dp_6"
android:layout_marginStart="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_24"
android:layout_toEndOf="@+id/tv_resident_weather_temp"
android:background="@drawable/shape_resident_weather_temp"/>
<TextView
android:id="@+id/tv_resident_weather_cond"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textSize="@dimen/sp_16"
android:textColor="@color/color_333333"
android:layout_marginTop="@dimen/dp_14"
android:layout_marginStart="@dimen/dp_6"
android:layout_toEndOf="@+id/tv_resident_degree" />
<TextView
android:id="@+id/tv_resident_temp_range"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="21~34℃"
android:textColor="@color/color_333333"
android:textSize="@dimen/sp_16"
android:layout_marginTop="@dimen/dp_5"
android:layout_below="@+id/tv_resident_weather_cond"
android:layout_toEndOf="@+id/tv_resident_degree"
android:layout_marginStart="@dimen/dp_6"/>
<TextView
android:id="@+id/tv_resident_aqi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textSize="@dimen/sp_16"
android:textColor="@color/color_333333"
android:layout_alignParentEnd="true"
android:layout_marginTop="14dp"
android:layout_marginEnd="@dimen/dp_10"/>
<ImageView
android:id="@+id/iv_resident_aqi"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_18"
android:src="@drawable/ic_icon_aqi"
android:layout_toStartOf="@+id/tv_resident_aqi"
android:layout_marginEnd="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_16"/>
<TextView
android:id="@+id/tv_resident_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 14:33 "
android:textSize="@dimen/sp_12"
android:textColor="@color/color_999999"
android:layout_marginEnd="@dimen/dp_10"
android:layout_alignParentEnd="true"
android:layout_below="@+id/tv_resident_aqi"
android:layout_marginTop="@dimen/dp_11"/>
</RelativeLayout>
왠 지 묘 하 다.완전.그리고 가능 한 이 유 를 곰 곰 이 생각해 보 세 요.해상도 가 적당 한 문제 때 문 이 아 닐 까요?
해상도 에 맞 는 사이즈 가 없습니다.그럼 레이아웃 에 있 는 모든@dimen 을 참조 하 는 곳 을 직접 사용 사이즈 로 바 꿔 보 세 요.
운행,성공!!
질문:레이아웃 상의 문제 가 발견 되 었 습 니 다.
사용자 정의 알림 표시 줄 에 배경 이 설정 되 어 있 습 니 다.폭 은 match 입 니 다.parent,그러나 일부 휴대 전화 에서 샤 오미 6(캡 처)와 같이 너비 가 전체 화면 에 가득 하지 않 은 것 을 볼 수 있 습 니 다.
하지만 화 웨 이,비보 등 휴대 전화 에 서 는 정상 이다.
그럼 이 배경 을 없 애고 적응 하 세 요.
총결산
안 드 로 이 드 가 상주 알림 표시 줄 에서 발생 하 는 문제 와 해결 방법 에 관 한 이 글 은 여기까지 소개 되 었 습 니 다.더 많은 안 드 로 이 드 상주 알림 표시 줄 내용 은 우리 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 조회 하 시기 바 랍 니 다.앞으로 많은 응원 바 랍 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Kotlin의 기초 - 2부지난 글에서는 Kotlin이 무엇인지, Kotlin의 특징, Kotlin에서 변수 및 데이터 유형을 선언하는 방법과 같은 Kotlin의 기본 개념에 대해 배웠습니다. 유형 변환은 데이터 변수의 한 유형을 다른 데이터...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.