124697
124697

Reputation: 21901

I can't see the graphical layout when I open an XML file

It shows a blank screen. I then have to click the blue/gray star icon and choose App theme, only then will elements show in the palette. I then have to drag an element from the palette onto the blank screen and drop it. Then the graphical layout will appear.

It used to work fine until I started playing around with themes and ActionbarSherlock.

I tried restoring defaults on all Android and XML settings but it didnt work.

Does anyone know how to fix it so that the XML graphical editor shows up when I open a layout XML file?

(The xml I am working with are not blank.)

Upvotes: 3

Views: 4434

Answers (8)

VJ   Vishal Jogiya
VJ Vishal Jogiya

Reputation: 339

Solution for andoird Studio Users. Below solution worked for me.

File --> Invalidate Caches and Restart --> Invalidate and Restart.

Hope this will work for you too.

Upvotes: 0

j2emanue
j2emanue

Reputation: 62559

mine never refreshes. So i open up another file then return back and then it refreshes. Even if i go to the palette to refresh it was not working. Also like others mentioned make sure your your api version is application to what you want rendered. So mine was set to api 20 but my project runs on api 17 so play with it. Heres a image:

enter image description here

notice how mines set to 17 - yours might be at 20 or something else that differs from your manifest. change it accordingly.

Upvotes: 0

Mohsen Afshin
Mohsen Afshin

Reputation: 13436

In the eclipse, right click on your XML file and choose Open With and then XML Editor

At the bottom of the page, you'll see Design and Source tabs. Click on the Source to see what you desired.

Upvotes: 0

bplattenburg
bplattenburg

Reputation: 696

Ok, so my best understanding is that you somehow overwrote or changed the default theme for that project with something other than AppTheme. You should be able to change that in the styles xml file (ProjectPath/res/values/styles.xml), assuming this is the same project.

For reference, mine works fine, and my project's styles.xml looks like this (new project):

<resources>

    <style name="AppTheme" parent="android:Theme.Light" />

</resources>

Upvotes: 0

jzafrilla
jzafrilla

Reputation: 1436

Try to increase -Xms128m -Xmx1024m when launch eclipse. I had the same problem because i don't have enough memory.

Hope this helps.

Upvotes: 0

Anup Cowkur
Anup Cowkur

Reputation: 20563

This happens with me sometimes if I haven't chosen an android version in the top-right corner of the graphical layout editor. Because the same theme might look different in different versions of Android, I guess eclipse doesn't know what to show you unless you select a specific version of android for the theme you have chosen.

It also sometimes happens with me, If I have used a Google API's version instead of Android X.X version as target build for my project. Maybe some bug in the developer tools.

Upvotes: 1

ernestkamara
ernestkamara

Reputation: 73

I guess your issue is Eclipse related, but try to be specific next time about your IDE since it may help you get the right answer. If you're using Eclipse i recommend that you check that your Android SDK Tools Eclipse plug-in (ADT) is up to date.

Upvotes: 1

Mohammad Ersan
Mohammad Ersan

Reputation: 12444

Every day i face this problem, especially when I add a new Andorid Project to workspace, the only solution I found is to restart Eclipse, I hope this will help you too.

Upvotes: 5

Related Questions