ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

带有Theme.Material的Android设计支持库

2019-07-25 00:37:24  阅读:160  来源: 互联网

标签:androiddesignsupport android android-design-library android-5-0-lollipop materia


我想在API 21开始的应用程序中使用新的设计支持库.
我想使用Theme.Material样式,但它只适用于Theme.AppCompat样式.
当我使用Theme.Material时,android会返回此错误:

error inflating class android.support.design.widget.textinputlayout”

我该如何解决?

先感谢您

Ps:抱歉我的英语不好,我是法国人.

更新:
这是我的代码

styles.xml

<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
    <item name="android:colorPrimary">@color/primary</item>
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
    <item name="android:colorAccent">@color/accent</item>
    <item name="android:colorControlNormal">@color/control_normal</item>
    <item name="android:textColorHint">@color/silver</item>
</style>

activity.xml

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="username"
        android:id="@+id/editText1" />

</android.support.design.widget.TextInputLayout>

的build.gradle

dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])

compile project(':facebook')
compile('com.twitter.sdk.android:twitter:1.1.0@aar') {
    transitive = true;
    exclude module: 'gson'
}

compile 'com.google.android.gms:play-services-plus:7.5.0'
compile 'com.google.android.gms:play-services-identity:7.5.0'
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:support-v13:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.soundcloud.android:android-crop:0.9.10@aar'

compile files('libs/volley.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/httpclient-4.3.3.jar')
compile files('libs/httpclient-cache-4.3.3.jar')
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/httpmime-4.3.3.jar')
compile files('libs/commons-lang3-3.3.2.jar')
compile files('libs/hellocharts-library-1.5.5.jar')
}

解决方法:

TextInputLayout依赖于AppCompat中的资源/属性.您需要使用AppCompat基本主题.

AppCompat themes是API 21上基于材料的主题的父级.因此,您将使用Material主题.

标签:androiddesignsupport,android,android-design-library,android-5-0-lollipop,materia
来源: https://codeday.me/bug/20190724/1527693.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有