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

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://www.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在线观看| 亚洲乱码一区二区三区人妇| 最新日韩欧美一区二区| 国产婷婷精品一区二区| 韩国久久久久三级成人| 日本a亚洲中文字幕永远| 国内精品人妻久久毛片| 欧美aⅴ精品一区二区三区| 国产亚洲精品精品国产亚洲| 亚洲毛片免费视频久久| 黄色av一本二本在线观看| 91在线看片国产免费观看| 国产在线高清精品二区| 天堂av一区二区在线播放| 我想看日韩一级黄色片| 新人妻一区二区在线视频| 中文字幕日韩有码在线| 青草免费在线播放视频| 91精品国产欧美在线| 白嫩少妇情久久密月久久| 一区二区三区四区蜜桃av| 日韩精品高清不卡一区二区三区| 日本韩国国产三级在线| 亚洲国产成人精品av在线| 国产精品久久久久精品爆| 青青草成人免费在线公开视频| 91香蕉国产精品日韩| 免费在线观看av大全| av中文字幕乱码在线看| 国产激情久久久久久久久久久| 亚洲精品有码中文字幕| 一区不卡在线视频免费国产| 精品av一区二区在线| 色婷婷激一区二区三区| 久久国产福利一区二区| 国产成人免费视频一区| 大香蕉欧美视频伊在线| 国产成人综合亚洲国产|