原创 Flutter json_serializable

  1 添加項目依賴 dev_dependencies: flutter_test: sdk: flutter build_runner: ^1.1.3 json_serializable: ^3.2.0 2 創建實

原创 圖片緩存--Fresco

Fresco中文文檔   本文完全從官網中摘錄,用於自身學習時簡單記錄,詳細可查看官文 關於Android圖片緩存,這是一個android程序員必須瞭解的。關於四大圖片緩存框架的特性與對比,請移步MDCC傳送門 關於Fresco的介紹,請

原创 string.xml 中大量string 提示 "XXX" is translated here but not found in default locale

原因:在默認的strings.xml裏沒有這個字段; 解決辦法:將Value/string.xml中的<resources>改成 <resources xmlns:tools="http://schemas.android.com/to

原创 kotlinx 編譯報錯 Unresolved reference:

在使用kotlin, 可以直接使用控件 ID 對控件進行操作,無需 findViewById() 來找到控件,然後才能操作該控件。該特性稱爲Static Layout Import,即靜態佈局引入。     需要在gradle(Modu

原创 lateinit 、lazy、apply 、 with

對比學習: https://github.com/MindorksOpenSource/from-java-to-kotlin   1、lateinit vs lazy lateinit :延遲初始化屬性與變量 class Test {

原创 filter、forEach、map、flatMap

forEach ArrayList<User> users = new ArrayList<>(); // Java 8+ users.forEach(user -> {

原创 Scaffold.of() called with a context that does not contain a Scaffold.

class TestWidget extends State<TestWidget> { @override Widget build(BuildContext context) { return Scaffold(

原创 ViewPager異常

1、       Java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling

原创 Kotlin NULL檢查和處理(?: 、 ?. 、 !!)

Kotlin校驗字符串空值的幾個方法: isNullOrEmpty : 爲空指針或者字串長度爲0時返回true,非空串與可空串均可調用。 isNullOrBlank : 爲空指針或者字串長度爲0或者全爲空格時返回true,非空串與可空串均

原创 CLEARTEXT communication to ***.*** not permitted by network security policy

Android P(9.0) 中OKHttp3網絡請求出現java.net.UnknownServiceException: CLEARTEXT communication ** not permitted by network secu

原创 使用CoordinatorLayout實現滾動標題欄效果

CoordinatorLayout提供Behaviors接口,子View通過實現Behaviors接口來協調和其它View之間的顯示效果,可以這麼理解: CoordinatorLayout讓其子View之間互相知道彼此的存在,任意一個子V

原创 Navigation組件使用入門

導航組件 官方文檔:https://developer.android.google.cn/guide/navigation?hl=zh_cn 一、設置環境 在應用的build.gradle文件中添加以下依賴 dependencies

原创 Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target

解決方案: 在app 下build.gradle配置如下 android { compileSdkVersion 29 buildToolsVersion "29.0.2" compileOptions {

原创 android ImageView長圖不顯示

  同一張長圖,在ImageView上 加載時,部分手機不顯示。提示如下異常: W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (1080x18151,

原创 Android studio "XXX" is not translated in "ko","pt","es"."tr","zh","ja"

strings.xml出現如下異常異常 原因:  Umeng包內的values-zh干擾導致 解決方法 在string.xml中配置 <resources xmlns:tools="http://schemas.android