Pavel Poley
Pavel Poley

Reputation: 5577

EditText not renders in Layout editor

My Android studio not renders EditText, I even created new project to verify it, the EditText is just blank.

I am using Android studio 4.0 and Gradle 4.0.

enter image description here

Upvotes: 0

Views: 2399

Answers (3)

MarkT
MarkT

Reputation: 488

I am having the same problem right now, well what I have noticed is that this problem is generated when you are adding a new qualifier; for example smallest screen width (let's say 720dp) and maybe another qualifier like orientation (let's say landscape).

Well here is what I noticed: first the view references like:

app: layout_constraintBottom_toBottomOf = ""
app: layout_constraintEnd_toEndOf = ""
app: layout_constraintDimensionRatio = "1: 1"
app: layout_constraintStart_toEndOf = ""
app: layout_constraintTop_toTopOf = ""

Even being in landscape they still have the references as if they were of portrait orientation. for example in a portrait screen mode, if you had two vertical guidelines (let's call them gui1 and gui2) and between these two you had some imageviews (let's call them iv, iv2, and iv3 and let's focus on iv2 and iv3) for example

when portrait:

app: layout_constraintTop_toBottomOf (hereinafter totobo)
app: layout_constraintStart_toStartOf = "@ id / gui1" (stst)
app: layout_constraintEnd_toEndOf = "@ id / gui2" (enen)

when the qualifier passes to landscape it does not change to what would correspond with the new orientation which would be something like this:

when landscape

app: layout_constraintEnd_toStartOf = "@ + id / iv2" (enst)
app: layout_constraintTop_toTopOf = "@ id / gui1" (tototo)
app: layout_constraintBottom_toBottomOf = "@ id / gui2" (bobo)

but no....

things continue like the first reference (totobo, stst, and enen) as if it had never changed orientation.

Unfortunately so far the solution is to remove all constraint, guideline (if you were using it) and practically write your as a

top_totop_of in portrait will probably be a stst when it is landscape. Personally I don´t think this is due what AS 4.x suggest you is the problem

Until now the only way I found to solve it is to delete constraints and rewrite the XML code to solve what I've explained before

in summary and as an example:

what in portrait was a "totobo" in landscape it's probably a stst

however that does not change and that is why according to my opinion that problem occurs, and can´t be solved with the AS´s wizard.

Upvotes: 0

Had the same problem, if not not similar...

I went to Project Structure and changed my dependency from com.google.android.material:material:1.2.0-alpha04 to com.google.android.material:material:1.2.0-alpha03

or you can go and change it in gradle.

Upvotes: -1

Ravi Kumar
Ravi Kumar

Reputation: 4508

In the designer window, at the top right corner, there is a symbol (Exclamation mark in a circle). if it's red, there might be some issue with the layout. You may have to enable the latest Layout Rendering Engine.

Android Studio 4.0 includes a new Layout Rendering Engine. Enable it and check if the issue still persists. if it's already enabled, you will get a the below message:

Rendering errors might be caused by the new Layout Rendering Engine. Disabling it by clicking here may fix the issue. It can later be enabled again using the Settings > Experimental dialog.

Upvotes: 3

Related Questions