4
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".fragments.MainFragment">

    <com.google.android.material.card.MaterialCardView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </com.google.android.material.card.MaterialCardView>

</androidx.constraintlayout.widget.ConstraintLayout>

Preview will looks like this:

enter image description here

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".fragments.MainFragment">

</androidx.constraintlayout.widget.ConstraintLayout>

Preview will looks like this:

enter image description here

I upgraded Android Studio to Electric Eel and now, in XML, the preview often fails to display properly as in the first image. Why does this happen and how can I resolve it? This issue only occurred after I upgraded Android Studio.

Taha Sami
  • 1,565
  • 1
  • 16
  • 43

2 Answers2

0

I have this issue too, I change material version to 1.7.0 and Android Studio Layout Rendering working again

-1

I downgraded the Material Design library from 1.8.0 to 1.7.0 and the problem disappeared. I think the issue was with the new version of the Material Design.


Update: I downloaded Android Studio Flamingo, and the problem was solved.

Taha Sami
  • 1,565
  • 1
  • 16
  • 43
  • 1
    No, the problem is definitely NOT the new version of the Material Design library, because I was already using the 1.7.0 version (I didn't upgrade to 1.8.0), and I still got the OP's issue. – fetchSerotonin Jan 30 '23 at 20:32