久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 TextInputLayout 時出現 InflateException

InflateException when using TextInputLayout(使用 TextInputLayout 時出現 InflateException)
本文介紹了使用 TextInputLayout 時出現 InflateException的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在嘗試使用 Material Design 中的 TextInputEditText (https://github.com/material-components/material-components-android/blob/master/docs/components/TextInputLayout.md),我遇到了運行時異常.

I'm trying to use TextInputEditText from Material Design (https://github.com/material-components/material-components-android/blob/master/docs/components/TextInputLayout.md) and I'm getting runtime exception.

這是運行日志的一部分:

This's part of run log:

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.example.grigori.materialtextedit, PID: 12036
              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.grigori.materialtextedit/com.example.grigori.materialtextedit.MainActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.google.android.material.textfield.TextInputLayout
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
                  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
                  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
                  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
                  at android.os.Handler.dispatchMessage(Handler.java:106)
                  at android.os.Looper.loop(Looper.java:193)
                  at android.app.ActivityThread.main(ActivityThread.java:6669)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
               Caused by: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.google.android.material.textfield.TextInputLayout
               Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.google.android.material.textfield.TextInputLayout
               Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.material.textfield.TextInputLayout" on path: DexPathList

我通過 DexPathList 剪切了這個日志,其中包含許多 apk 文件的路徑,例如:

I cut this log by DexPathList that contains many paths to apk files, like:

zip file "/data/app/com.example.grigori.materialtextedit-jamgTcrgG9neBKIMcqDo7Q==/base.apk"

我的 xml 文件:

<android.support.constraint.ConstraintLayout 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="match_parent"
tools:context=".MainActivity">

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/hint_text"/>

</com.google.android.material.textfield.TextInputLayout>

我的 build.gradle 依賴:

My build.gradle dependences:

    dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'}     

推薦答案

在我現有的項目中實現 AndroidX 時遇到了這個問題.

Faced this issue when implementing AndroidX in my existing project.

implementation 'com.google.android.material:material:1.0.0-beta01'

布局 XML

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/userNameWrapper"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/TextLabel">

舊式

<style name="TextLabel" parent="TextAppearance.AppCompat">
        <item name="android:textColorHint">@color/hint_color</item>
        <item name="android:textSize">@dimen/text_20sp</item>
        <item name="colorControlNormal">@color/primaryGray</item>
        <item name="colorControlActivated">@color/colorPrimary</item>
    </style>

新風格

<style name="TextLabel" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
        <item name="android:textColorHint">@color/hint_color</item>
        <item name="android:textSize">@dimen/text_20sp</item>
        <item name="colorControlNormal">@color/primaryGray</item>
        <item name="colorControlActivated">@color/colorPrimary</item>
    </style>

這篇關于使用 TextInputLayout 時出現 InflateException的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 国产成人自拍av | 久久久久免费精品国产小说色大师 | 播放一级黄色片 | 国精产品一品二品国精在线观看 | 久草视频2 | 四虎影院在线观看av | 中文字幕第49页 | 国产三区精品 | 欧美精品二区 | 亚洲免费一区 | 久久久久久久久淑女av国产精品 | 亚洲国产激情 | 亚洲一区 | 午夜久久久久久久久久一区二区 | 国产精品成人一区二区三区夜夜夜 | 成人在线小视频 | 午夜精品久久久 | 日日噜 | 久久国产电影 | 日本久久www成人免 成人久久久久 | 欧美影院 | 亚洲 欧美 另类 日韩 | 亚洲 中文 欧美 | 日韩av在线中文字幕 | 欧美 日韩 国产 成人 在线 | 国产伦精品一区二区三区精品视频 | 岛国精品| 亚洲精品免费视频 | 国产精品日韩欧美 | 最新日韩在线视频 | 国产精品一区二区三区在线 | 亚洲成人一区二区 | 午夜婷婷激情 | 久久精品国产99国产精品 | 99精品国产一区二区青青牛奶 | 欧美日批 | 亚洲成人av在线播放 | 日韩视频在线免费观看 | 人人九九精 | 久久久久久久国产 | 亚洲免费在线观看 |