Haseeb Wajid
Haseeb Wajid

Reputation: 39

preview of my layout in xml file not showing?

i have created 4 activities they all were work well but suddenly the preview of design in XML file is not showing I have tried to reopen my android studio also that specific XML. but the problem is still here. XML code is showing but only the preview of design is not showing here the ss of screen. please check and help me to solve this out.

split_mode of Xml file

design_mode of XML file.

Upvotes: 1

Views: 7164

Answers (6)

Aditya_Giri
Aditya_Giri

Reputation: 76

I am face this issue during working on project.

Hours of research and try error , finally i solved this issue.

Please follow below steps:-

  1. Delete .gradle and .idea file
  2. Delete app/build folder
  3. Restart Computer

Done now xml preview show.

Upvotes: 0

BobTheCat
BobTheCat

Reputation: 668

I have tried all the method from above, unfortunately, nothing work.

Upgrade to Android Studio Flamingo | 2022.2.1. fix the problem. enter image description here

(from my experience, this issue occurred on Dolphin and Electric Eel. Before that, Chipmunk was fine)

Upvotes: 2

Marcel Hofgesang
Marcel Hofgesang

Reputation: 1040

I came to the solution of mia. She suggests to use

implementation 'com.google.android.material:material:1.8.0-alpha01'

in the apps build.gradle. This bug appeared initially to me with version 1.8.0. Also tried unsuccessfully with versions 1.8.0-alpha02 and 1.9.0-beta01.

Upvotes: -1

cjy2103
cjy2103

Reputation: 41

This is a log on StackOverFlow for those who continue to have problems after doing a clean build, invalidating caches and restarting, and restarting the computer.

Check if the element of the view has a custom view imported from an external library.

Ex. In my case, I was using YouTubePlayerView of YouTubeAPI.

Obviously, the preview worked fine until Chipmunk.

However, the preview has not been released since Dolphin.

So I annotated the YouTube player view.

Then the preview was displayed normally.

In fact, I've confirmed that other people are experiencing the same problem as above.

So my guess is that custom views from libraries that are no longer updated as Gradle versions go up are not compatible with each other.

In that case It seems to be a problem caused by using an external library view called de.hdodenhof. enter image description here

Upvotes: 0

Kevin Patel
Kevin Patel

Reputation: 51

you just need to do invalidate Caches and restart, I have provided an image for you to know what to do exactly. in android studio, go to the top left corner and select file and click on Invalidate Caches/restart and that will restart your android studio. than try to open your xml layout.

Image

Upvotes: 0

dharmik nanavati
dharmik nanavati

Reputation: 21

please try the following steps:

  1. clean project
  2. delete .idea and .gradle file
  3. remove app/build folder
  4. now do invalid cache and restart

if still your problem is not solved then try to restart your computer

Upvotes: 2

Related Questions