[java] Where is Android Studio layout preview?

I installed Android Studio, but when I edit my layout files, I can't find live preview! I just see an XML file. How can I see my layout in graphical view?

Update: This is how it looks like in my case:

enter image description here

This question is related to java android android-studio

The answer is

I had the same issue and resolved by editing the t file in src>main>res>layout. You can choose between Test and Design mode at the bottom of editor.

Quite simple if we know where to look for !!! spend few hours figuring it out!!!

If you see a message at the bottom saying something like, "Android Framework detected. Click to configure", DO IT.

After doing this, my Text and Design bottom-tabs appeared.

In case you want docked mode, (it still visible while editing the xml file), and you, by mistake, clicked and unmarked docked mode. In order to get it back you have focus on preview and click Window > Active Tool Window > Docked Mode.

The following worked for me:

-> file

-> settings

-> plugins

-> disable the android support plugin

-> you will be prompted to restart

-> once restarted re-enable the plugin and other dependency plugins that might have been disabled in the process

-> you will be prompted to restart once again. Hopefully when android studio restarts the second time the preview should render.

If you want to see the live preview, in the right part of the screen you should have a button call Preview that show/hide the live preview.

If what you want is to use the WYSISYG editor mode, in the bottom of the editor there is a tab that switch between XML mode and WYSISYG mode.

This works in the same way both in IntelliJ and Android Studio.

first of all after creating the new app

go to java->MainActivity

and open a new tab for it

In the java code click on the index numberings where you can see the code logoenter image description here

as red circled in picture

left click on it and you will see two options as shown in below pictureenter image description here

click on the first option so that you can preview your app in android studio

  1. Select MainActivity.java file from the left pane, as shown in the red colored rectangle.

  2. Left click the XML Tag icon as shown in the red colored circle.

  3. Select the "activity_main.xml(layout)" option shown highlighted in the below figure.

enter image description here

I had this problem a couple hours ago when I exported my projects from Eclipse to Android Studio. Unfortunately, the top answers here didn't work for me.

Anyway, creating a new project instead of opening an old one did the trick for me as what Thomas Kaliakos mentioned on his comment here

I had to mess around with the project..and at some point it worked. I don't know how though. My guess would be that creating a new project and adding your source code would work every time. Sorry for not being very clear, but honestly I was surprized even myself that it worked. – Thomas Kaliakos Oct 15 '13 at 4:08

I am using Android studio 3.3 and this method worked for me: open settings from file/settings from the left panel select Editor then layout Editor then from the right panel uncheck third option which is "Hide preview window when editing non-layout files" then hit apply then ok. then go to view/tool windows/preview is enable now in the design tab of layout XD. Do not forget up vote and marking this answer as the right answer. Happy coding. enter image description here

Got the same problem after importing my Eclipse ADT project to Android Studio. Text and Desing tabs where missing.

Found my Event Log windows reads "Frameworks detected: Android framework is detected in the project Configure"

I click the hyperlink provided and everything was fixed, Text and Desing tabs became visible and functional

As etienne said be sure that the XML file you are looking at is in src/main/res/layout

I had the same issue. If you're in a layout file in build directory, you won't see a preview, nor will you have it as an option to enable. I wish Google had a slight warning for it.

Go to File > Settings > Appearance & Behavior > Appearance > Show tool window bars

  1. Go to File->Invalidate Caches/ Restart. After restarting the preview window will come.

  2. Still the preview window is not opened, Go to View -> Tool window -> click Preview

I found 2 quick options to fix this:

  1. Just input in search "Preview" and it will show you a single result. Just click on it and preview appears again :)
  2. Pull the right-side line and window will appear. It's kinda resize.

Preview window in android studio

Happy coding!

In case that helps anyone, I had the same issue today where the 'design / text' tabs were missing. I had switched to the dark theme and thought maybe that was the issue, so went back to Preferences / Appearance (under IDE settings) switched back to Default Theme, and that reset everything correctly for me. I could also then switch again to Darcula theme and the tabs were still there, so seems like switching themes is a way to reset the IDE windows/tabs.

File>>setting>>Compiler>>JavaCompiler At "Project bytecode version(leave blank for jdk default):" choose your jdk.

enter image description here

Navigate to file -> Project structure -> modules -> click on green plus button to add a module.

Select new module -> select Application Module in Android option -> give a module name -> next -> next -> finish

Select project that to be include in module -> click apply -> okay

Now you will be able to see the full project structure; then open the module form project window (the left panel), select res then select layout -> your layout name(.xml).

Now you will be able to see the design view and text view both...

For those struggling in Android Studio 3.6:

enter image description here

Go to File->Invalidate Caches / Restart.

This will solve the issue.

Several people seem to have the same problem. The issue is that the IDE only displays the preview if editing a layout file in the res/layout* directory of an Android project.

In particular, it won't show if editing a file in build/res/layout* since those are not source directory but output directory. In your case, you are editing a file in the build/ directory...

The Resource folder is set automatically, and can be viewed (and changed) in Project Structure > Modules > [Module name] > Android > Resources directory.

In my case, I don't have Design or Preview tab.


  • Configure the proxy rightly to download necessary components
  • Configure the android-sdk path to contains no space character
  • Restart Android Studio in Admin mode

Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK