查看背景问题

时间:2016-05-20 18:14:52

标签: android

这发生在几天前。仍然无法找到解决问题的方法。

这是一个简单的测试项目。 http://s000.tinyupload.com/index.php?file_id=03903482111052488979

非常简单的布局:

    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    >

    <EditText
        android:id="@+id/editUsername"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:ems="10"
        android:hint="@string/input_hint_email"
        android:inputType="textEmailAddress"
        />

    <EditText
        android:id="@+id/editPassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="@string/edit_hint_password"
        android:inputType="textPassword"
        android:layout_gravity="center"
        />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:text="Enter"
        />

</LinearLayout>

Gradle重要部分:

compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {

    minSdkVersion 16
    targetSdkVersion 23

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.2.1'
}

Ple-lollipop设备(genymotion和真实设备)

背景(按下,有时正常)看起来像9补丁文件有问题。一些受影响的视图 - 导航视图中的项目,菜单项,edittext edittext - https://gyazo.com/71f13003a46ff596514e475a72f924b7 按下的菜单项 - https://gyazo.com/7a5d9db29e17524e353f10a18562786e

Lollipop直到5.1

启动时崩溃(在appcompat 23.1.1及更低版本上停止崩溃)

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ww.aeli.wtf.MainActivity}: android.view.InflateException: 
Binary XML file line #11: Error inflating class EditText
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class EditText                                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
 Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v21/abc_edit_text_material.xml from drawable resource ID #0x7f020015                                                                   at android.content.res.Resources.loadDrawableForCookie(Resources.java:2428)
 Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #24: <nine-patch> requires a valid 9-patch source image                                                                   at android.graphics.drawable.NinePatchDrawable.updateStateFromTypedArray(NinePatchDrawable.java:445)

Lollipop 5.1和棉花糖

一切正常

我尝试了什么

问题也在其他开发者机器上重现。

将appcompat降级到版本23.0.0。 Lollipop不会在23.1.1及更低版本崩溃,但背景问题仍然存在。

禁用矢量支持(主要的23.2.0功能,理论上可能会影响)。

最近类似的问题 - https://code.google.com/p/android/issues/detail?id=210467(讨论以奇怪的方式进行),https://github.com/afollestad/material-dialogs/issues/1081https://code.google.com/p/android/issues/detail?id=210547

老年人: https://code.google.com/p/android/issues/detail?id=198457

1 个答案:

答案 0 :(得分:1)

好吧,我找到了通往&#34;修复&#34;所有问题都是在发布问题之后。

将gradle版本从2.2.0-alpha1降级为2.1。+将解决所有问题。

再次注意自己 - 永远不要使用&#34; +&#34;在图书馆版本中。