21

I have downloaded the new android studio that has been released recently. I am unable to find the UI design preview for the xml, as it is in eclipse. Any help or suggestions on that?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Nitesh Verma
  • 1,795
  • 4
  • 27
  • 46
  • What happened when you Googled for this, or checked the online help, or the Jetbrains Knowledge Base? – Simon May 20 '13 at 07:20
  • were u successful in getting the UI? – Nitesh Verma May 20 '13 at 07:23
  • I was trying to suggest that SO is not the best, or correct place to ask simple "how do I" questions on an unreleased, unsupported product. View->Tool Windows. Please take the time to learn the menu structure and window system of IDEA rather than ask a question every time you can't find something. The online help is also very good. – Simon May 20 '13 at 07:41
  • 1
    `This is NOT a user issue...this is a BUG in the software!` I have found a way to access it, however, it is very annoying because it can ONLY be viewed in landscape mode....in the Preview tab! I just installed Android Studio 0.2.7 and was not able to get to the UI designer (Palette), after some playing around, I was able to. 1) switch `State` to landscape, or 2) under "Configuration to render this layout with the IDE" in the preview tab (next to the device render option!), and create a new portrait orientation configuration – Christopher Rucinski Sep 07 '13 at 03:17
  • > "What happened when you Googled for this?" You now get this stack overflow question, I'm glad it got answered. – Ryan Leach Apr 09 '14 at 13:53

1 Answers1

37

Open a xml layout file:

  • at the bottom, you have two tabs: Design/Text enter image description here
  • in design mode, you see the preview directly
  • in text mode, the preview is (by default) on the right, toggled by a 'Preview' button in the rightmost bar

enter image description here

You can also show/hide it with View > Tool Windows > Preview

EDIT

Attention: 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 be displayed if editing a file in build/res/layout* since those are not source directory but output directory.

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

etienne
  • 3,146
  • 1
  • 24
  • 45
  • there are no tabs at the bottom. I tried the View > Tool Windows , it also doesn't have the Preview option. I there something wrong with my ide? – Nitesh Verma May 20 '13 at 08:00
  • Probably an issue with the file you are editing; is it an android layout file? – etienne May 20 '13 at 08:01
  • the file has to be activity_main.xml right?\ – Nitesh Verma May 20 '13 at 08:09
  • 3
    The name isn't relevant. But the file should be in a layout*/ folder in the res directory of your project. Check the configuration of the project folders in `Project Structure > Facets > Android > Resources Directory` – etienne May 20 '13 at 08:11
  • ... of an Android project? – etienne May 20 '13 at 08:25
  • yes exactly of an android project. – Nitesh Verma May 20 '13 at 08:26
  • 1
    i suppose i got it. I was in the build/res/all/debug/layout but the design view came when i used the same file name from src/main/res/layout. Thanks for so much help. I got a bit confused on that. – Nitesh Verma May 20 '13 at 08:30
  • 1
    i also had the same problem. I can't find the 'Design' tab. Could you please help me to solve this problem? – Jomia May 21 '13 at 11:33
  • 2
    @Jomia see: http://stackoverflow.com/questions/16660039/where-is-android-studio-layout-preview/16669780#16669780 – etienne May 21 '13 at 12:44
  • @etienne Thanks for the tips.. Now i can see the design tab – Jomia May 22 '13 at 07:57
  • I had this problem from a fresh install and new project created by the wizard. No tabs. Close file, re-open (wasn't in recent files!) from project pane, and now it has Design/Text tabs. Buggier than Eclipse! – Nick Westgate Oct 11 '13 at 23:32
  • 1
    This worked for me; sure would've been nice if `View => Tool Windows => Designer` weren't disabled even though clearly the designer was NOT visible. :/ – Darth Continent Apr 18 '14 at 22:50