Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3.4.1 constraintlayout editor preview not working AGAIN

I believe I have had similar issues in the past ever since v3.x and they keep coming. I don't know how many hours I have to spend on trying to use the layout editor and they just can't get it right.

Anyway, here is the xml code:

<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
    android:id="@+id/textView"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:text="TextView"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

Here is how it looks:

enter image description here

Any item I drag in gets put in the top left corner with 0 size. No matter if you set exact sizes or just constraints.

My Android Studio version is 3.4.1
Using 28.0.0 support libs.
I cannot downgrade due to company policy, so that's not an option.

Constraint Layout version is the latest:

implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta1'

It did not work with earlier versions either.

I have tried several things which "worked" earlier with other similar bugs:

  • Using different themes
  • Trying different API versions in the layout editor
  • Invalidate cache/restart
  • Updated Android Studio (to this version)

Any suggestion is welcome

like image 782
breakline Avatar asked May 20 '19 11:05

breakline


2 Answers

Just cleaning the project worked for me.

like image 60
Onur OKYAY Avatar answered Oct 26 '22 23:10

Onur OKYAY


So basically the issue was completely elsewhere in another layout file, nothing to do with constraint layout. Anyway after a clean and build AND restart it eventually worked!

like image 26
breakline Avatar answered Oct 27 '22 00:10

breakline