ConstraintLayout 1.0.2什么也没显示 [英] ConstraintLayout 1.0.2 shows nothing

查看:68
本文介绍了ConstraintLayout 1.0.2什么也没显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然有这个奇怪的问题. ConstraintLayout仅在'alpha-7'上有效,当我将其更改为最新版本'1.0.2'时,它什么也没显示

I'm still having this weird problem. ConstraintLayout only works when it's on 'alpha-7', when I change it to '1.0.2' the latest version it shows nothing

所需的布局应如下所示:

Desired layout should look like this:

但是,我得到的是:在真正的HTC上,一个M9-CM 12.1.1"

However, I'm getting this: "on a real HTC one M9 - CM 12.1.1"

**显示布局范围"处于开"状态只是为了让您看到设备上没有绘制任何内容.

** 'Show layout bounds' is On just so you can see that there are nothing on drawn on the device.

**我还尝试了显示布局更新",但也没有显示任何内容

** I also tried with 'Show layout update' and it shows nothing as well

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

In the Layout Inspector the Username field, Password field and Login Button and showing:

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不显示任何内容

LogCat shows nothing

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

build.gradle

repositories {
    jcenter();
}

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

我尝试过的事情:

  • 使Android Studio无效并重新启动.

  • Invalidating and restarting Android studio.

在仿真器上尝试过.

在华为设备上尝试过.

在一台HTC M9设备上尝试过.

Tried on an HTC one M9 Device.

回滚到"Alpha-7"效果很好.

Rolling back to 'Alpha-7' works fine.

如果您需要更多详细信息,请在评论中让我知道

推荐答案

在等待了关于"Alpha-7"发生的事情和发生的事情的真实解释的一年之后,我"Kindaaa〜"将其弄清楚了.

After a year of waiting for a real explanation of what is going on and what happened after 'Alpha-7', I "Kindaaa~"figured it out.

简短答案

使用ConstraintLayout进行的活动会很好.但是,如果要在顶部添加一个片段,请确保使活动背景透明.

Activities with ConstraintLayout will do fine. however if you are adding a fragment on top, then make sure to make the activity background transparent.

这篇关于ConstraintLayout 1.0.2什么也没显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆