简体   繁体   中英

Android: Graphical Layout not working - doesn't show anything

My situation is: I once made an android project(2.2 version) but soon needed to format my computer. After formatting, I downloaded eclipse again but when I imported my project, I wasn't able to use the 'graphical layout' menu for xml. It doesn't show me anything like the picture below.

http://img525.imageshack.us/img525/3586/19978552.png

I cleaned the project and updated the Android SDK, however, none of these seemed to work well. What could be causing this?

Try restarting Eclipse. Usually that solves the problem for me when that happens.

Right click on your layout xml file and select Open With -> Android Layout Editor . It will force eclipse to open file in android's layout editor mode

None of above worked for me. what worked for me is:

1- Select a Google APIs Project Build Target rather than one of the Android XX ones. This setting is in right click on project -> Properties->Android.

2- Make a change in XML and save it. Now switch back to "Graphical Layout" and it will show the layout.

For some, only 2nd step works.

This Question was asked 3 year ago, I am sure that you have get your solution, however i was also facing the same problem but got the solution in eclipse, here it is:-

1)Goto help->AboutEclipse->Installation details.
2)check the version of Android DDMS, Android development tool, Android hierarchy viewer, Android native development tool, Android trace view and tracer for openGl ES in installed software tab.
3)If they have different version than you have to update all of them.
4)Goto help->check for update in eclipse and follow the instruction.
5)Then restart eclipse.

This solve my problem.

The topic seems a little bit cold, but I wanted to add it nonetheless.

I had a similar problem with my layouts recently. When i create a project it automatically creates the layouts in the latest version of Android (eclipse shows it as version 22 of android as of today). But i can't see anything. So i just change the version to, say 18, and it shows ok. Furthermore if i want to change it back to version 22 it throws and exception, saying that a class can't be instantiated. (I am probably missing a class or a library on my system.)

Therefore if you cant see the layout it might be a good idea to switch back to earlier versions for development. cheers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM