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:
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 layout:
<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 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
repositories {
jcenter();
}
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
Things I tried:
Invalidating and restarting Android studio.
Tried on an emulator.
Tried on a Huawei Device.
Tried on an HTC one M9 Device.
Rolling back to 'Alpha-7' works fine.
Please if you need any more details let me know in the comment
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.
The Short Answer
Activities with ConstraintLayout will do fine. however if you are adding a fragment on top, then make sure to make the activity background transparent.