欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

android實現(xiàn)常駐通知欄報的案例分析-創(chuàng)新互聯(lián)

創(chuàng)新互聯(lián)www.cdcxhl.cn八線動態(tài)BGP香港云服務器提供商,新人活動買多久送多久,劃算不套路!

溫嶺ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:028-86922220(備注:SSL證書合作)期待與您的合作!

小編給大家分享一下android實現(xiàn)常駐通知欄報的案例分析,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討方法吧!

實現(xiàn)常駐通知欄時遇到的問題:

無論如何就是不顯示通知,查看日志發(fā)現(xiàn)貌似報錯了:

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實現(xiàn)常駐通知欄報的案例分析

 根據(jù)報錯信息來看,就是這個

android.support.constraint.ConstraintLayout

的問題了。

然后將布局的根view修改為RelativeLayout。

運行,報錯,,,,納尼?

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)

雖然繼續(xù)報錯,但是發(fā)現(xiàn)跟第一次報的錯不同了,說明第一個報錯問題解決。

那么來細看第二個報錯信息:

Binary XML file line #2: You must supply a layout_height attribute.

看信息是說布局中缺少layout_height屬性,但是確認布局中設置了這屬性啊。。。

<&#63;xml version="1.0" encoding="utf-8"&#63;>
<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="空氣優(yōu)"
   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="浦東新區(qū) 14:33發(fā)布"
   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>

分享文章:android實現(xiàn)常駐通知欄報的案例分析-創(chuàng)新互聯(lián)
當前地址:http://aaarwkj.com/article34/ccphse.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、網(wǎng)站設計公司、網(wǎng)站排名、移動網(wǎng)站建設、企業(yè)網(wǎng)站制作、全網(wǎng)營銷推廣

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名
色婷婷久久五月中文字幕| 香蕉视频欧美日韩国产| 久久av一区二区三区.| 日本欧美一区二区三区高清| 成年人免费观看黄色片| 午夜午色夜之日本福利片| 乱熟av一区二区三区| 男女性情视频免费大全网站| 九九九热视频这里只有精品| 青青草原在线视频一区| 欧美人与性一区二区三区| 国产一区二区欧美精品| 欧美精品福利一区二区三区| 日韩成人精品一区欧美成人| 公交车上没穿内裤被插高潮不断| 国产麻豆91在线视频| 国产成人综合精品久久| 国产aaa级日本一区二区三区 | av毛片在线观看地址| 黄色三级欧美一区二区| 国产日产亚洲综合一区| 欧美日韩国产精品一区二区在线观看| 亚洲国产精品中文字幕一区久久| 一区二区视频精品在线观看| 亚洲另类熟女国产精品老| 国产大片久久午夜电影| 日本高清区一区二区三区四区五区| 亚洲毛片免费视频久久| 2022国产精品一区| 亚洲人成免费观看网站| 亚洲精品成人综合色在线| 在线观看日韩三级av| 蜜臀午夜精品视频在线观看| 国产精品美女自拍视频| 免费福利激情在线播放| 91精品人妻二区三区| 亚洲av毛片在线免费播放| 日本乱一区二区三区在线| 啊啊啊用力好大视频| 国产男女爱猛视频在线| 精品蜜桃臀91人少妇|