ConstraintLayout 1.0.2 什么都不显示

ConstraintLayout 1.0.2 shows nothing

我仍然遇到这个奇怪的问题。 ConstraintLayout 仅在启用 'alpha-7' 时有效,当我将其更改为最新版本“1.0.2”时,它什么都不显示

所需的布局应如下所示:

但是,我得到了这个:"on a real HTC one M9 - CM 12.1.1"

** 'Show layout bounds' 处于开启状态,因此您可以看到设备上没有绘制任何内容。

** 我也试过 'Show layout update' 也没有显示

在布局检查器中,用户名字段、密码字段和登录按钮显示:

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:id="@+id/fragment_login"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/login_background"
    android:clickable="true"
    tools:context=".ui.login_sing_up.LoginFragment">

    <android.support.design.widget.TextInputLayout
        android:id="@+id/login_username_container"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="250dp"
        android:textColorHint="@color/Azure"
        android:visibility="visible"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/login_username"
            android:layout_width="300dp"
            android:layout_height="50dp"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:hint="@string/Username_or_Email"
            android:inputType="textNoSuggestions|textEmailAddress"
            android:lines="1"
            android:linksClickable="false"
            android:textColor="@color/Azure"
            android:textColorHighlight="@color/black"
            android:textColorHint="@color/Azure"
            android:visibility="visible" />

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

    <android.support.design.widget.TextInputLayout
        android:id="@+id/login_password_container"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:textColorHint="@color/Azure"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/login_username_container"
        app:passwordToggleEnabled="true">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/login_password"
            android:layout_width="300dp"
            android:layout_height="50dp"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:hint="@string/password"
            android:inputType="textPassword"
            android:lines="1"
            android:linksClickable="false"
            android:textColor="@color/Azure"
            android:textColorHighlight="@color/black"
            android:textColorHint="@color/Azure" />
    </android.support.design.widget.TextInputLayout>

    <Button
        android:id="@+id/login_login"
        style="@style/Base.Widget.AppCompat.Button.Colored.login"
        android:layout_width="150dp"
        android:layout_height="50dp"
        android:layout_marginTop="8dp"
        android:text="@string/login"
        app:layout_constraintLeft_toLeftOf="@+id/login_password_container"
        app:layout_constraintRight_toRightOf="@+id/login_password_container"
        app:layout_constraintTop_toBottomOf="@+id/login_password_container" />


</android.support.constraint.ConstraintLayout>

LogCat 什么都没显示

07-20 20:00:01.028 7144-7144/? I/art: Late-enabling -Xcheck:jni
07-20 20:00:01.083 7144-7158/? E/art: Failed sending reply to debugger: Broken pipe
07-20 20:00:01.084 7144-7158/? I/art: Debugger is no longer active
07-20 20:00:03.344 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx I/LoadedApk: No resource references to update in package common
07-20 20:00:03.344 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx I/LoadedApk: No resource references to update in package com.brit.swiftdark
07-20 20:00:03.346 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx I/InstantRun: starting instant run server: is main process
07-20 20:00:03.473 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx W/ResourceType: For resource 0x01030224, entry index(548) is beyond type entryCount(29)
07-20 20:00:03.473 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx W/ResourceType: For resource 0x01030224, entry index(548) is beyond type entryCount(29)
07-20 20:00:03.511 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-20 20:00:03.614 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/DispatcherActivity: there is no user
07-20 20:00:03.621 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/UserCoordinator: making new Instance
07-20 20:00:03.652 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/DispatcherActivity: checking if there is user in Pref
07-20 20:00:03.653 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/DispatcherActivity: there is no user in Pref
07-20 20:00:03.653 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/DispatcherActivity: there is no user
07-20 20:00:03.658 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/DispatcherActivity: createFragment-LoginFragment
07-20 20:00:03.856 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/LoginFragment: creating ver
07-20 20:00:03.856 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/LoginFragment: done creating ver
07-20 20:00:03.861 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/DispatcherActivity: onResume
07-20 20:00:03.861 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/DispatcherActivity: onResume - null == mUC
07-20 20:00:03.861 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/UserCoordinator: got Instance from preferences
07-20 20:00:03.862 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/UserCoordinator: get userCoordinator
07-20 20:00:03.873 7144-7249/xxxxxxxxxxx.xxxxxxxxxxxxx D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
07-20 20:00:03.877 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx D/Atlas: Validating map...
07-20 20:00:03.878 7144-7169/xxxxxxxxxxx.xxxxxxxxxxxxx W/Binder: Caught a RuntimeException from the binder stub implementation.
                                                                java.lang.NullPointerException: Attempt to read from field 'android.view.HardwareRenderer android.view.View$AttachInfo.mHardwareRenderer' on a null object reference
                                                                    at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:476)
                                                                    at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1089)
                                                                    at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:546)
                                                                    at android.os.Binder.execTransact(Binder.java:446)
07-20 20:00:03.944 7144-7249/xxxxxxxxxxx.xxxxxxxxxxxxx I/Adreno: QUALCOMM build                   : 065751b, 
                                                                Build Date                       : 04/15/15
                                                                OpenGL ES Shader Compiler Version: E031.25.03.07
                                                                Local Branch                     : 
                                                                Remote Branch                    : quic/LA.BF64.1.2.1_rb2.9
                                                                Remote Branch                    : NONE
                                                                Reconstruct Branch               : AU_LINUX_ANDROID_LA.BF64.1.2.1_RB2.05.01.00.081.016 + 065751b +  NOTHING
07-20 20:00:03.967 7144-7249/xxxxxxxxxxx.xxxxxxxxxxxxx I/OpenGLRenderer: Initialized EGL, version 1.4
07-20 20:00:03.989 7144-7249/xxxxxxxxxxx.xxxxxxxxxxxxx D/OpenGLRenderer: Enabling debug mode 0
07-20 20:00:04.121 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@3781b87d time:768477070
07-20 20:00:04.130 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-20 20:00:04.130 7144-7144/xxxxxxxxxxx.xxxxxxxxxxxxx E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

build.gradle

repositories {
    jcenter();
}

dependencies {
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
}

我尝试过的事情:

如果您需要更多详细信息,请在评论中告诉我

在 'Alpha-7' 之后发生的事情和发生的事情的真正解释等待了一年之后,我 "Kindaaa~" 想通了。

简答

带有 ConstraintLayout 的 Activity 会很好。但是,如果您要在顶部添加片段,请确保 activity 背景透明。