简体   繁体   English

Android:图形布局无法正常工作 - 不显示任何内容

[英]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. 我的情况是:我曾经做过一个android项目(2.2版本)但很快就需要格式化我的电脑。 After formatting, I downloaded eclipse again but when I imported my project, I wasn't able to use the 'graphical layout' menu for xml. 格式化后,我再次下载了eclipse,但是当我导入项目时,我无法使用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. 我清理了项目并更新了Android SDK,但是,这些似乎都没有。 What could be causing this? 可能是什么导致了这个?

Try restarting Eclipse. 尝试重新启动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 . 右键单击布局xml文件,然后选择打开方式 - > Android布局编辑器 It will force eclipse to open file in android's layout editor mode 它将强制eclipse在android的布局编辑器模式下打开文件

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. 1-选择Google API项目构建目标而不是Android XX项目之一。 This setting is in right click on project -> Properties->Android. 右键单击项目 - >属性 - > Android,此设置。

2- Make a change in XML and save it. 2-对XML进行更改并保存。 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:- 这个问题在3年前被问过,我相信你已经得到了解决方案,但是我也遇到了同样的问题但在eclipse中得到了解决方案,这里是: -

1)Goto help->AboutEclipse->Installation details. 1)转到help-> AboutEclipse->安装细节。
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. 2)在已安装的软件选项卡中检查Android DDMS,Android开发工具,Android层次结构查看器,Android本机开发工具,Android跟踪视图和openGl ES跟踪器的版本。
3)If they have different version than you have to update all of them. 3)如果他们的版本不同,则必须更新所有版本。
4)Goto help->check for update in eclipse and follow the instruction. 4)转到帮助 - >在eclipse中检查更新并按照说明操作。
5)Then restart eclipse. 5)然后重启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). 当我创建一个项目时,它会自动在最新版本的Android中创建布局(eclipse将其显示为今天的Android 22版本)。 But i can't see anything. 但我看不到任何东西。 So i just change the version to, say 18, and it shows ok. 所以我只是将版本更改为,比方说18,它显示确定。 Furthermore if i want to change it back to version 22 it throws and exception, saying that a class can't be instantiated. 此外,如果我想将其更改回版本22,则抛出异常,表示无法实例化类。 (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. 干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在“图形布局”选项卡上不显示任何内容 - Don't show anything on Graphical Layout Tab android.gesture.GestureOverlayView没有显示在图形布局上 - android.gesture.GestureOverlayView doesn't show on the graphical layout 我无法拖放任何东西来布局Android中的图形界面 - I can't drag or drop anything to layout graphical interface in Android Android布局-ImageView聚焦,但在屏幕上不显示任何内容(不突出显示) - Android layout - ImageView focused, but doesn't show anything on screen (no highlight) Android Maven原型项目布局在ADT图形编辑器上显示不正确 - Android Maven archtype project layout doesn't show correct on ADT Graphical Editor Y图形布局有时在Eclipse&MOTODev上不显示吗? - Y graphical layout doesn't show sometimes on eclipse &MOTODev ? ViewPager拖放选项未在图形布局中显示 - ViewPager Drag and Drop Option doesn't show up in Graphical Layout Eclipse Android图形布局未显示任何内容 - Eclipse Android Graphical Layout Not Showing Anything Eclipse Android插件图形布局未显示任何内容 - Eclipse Android Plugin Graphical Layout Not Showing Anything 为什么图形布局(适用于Android)没有出现在Eclipse中? - Why Graphical layout (for android) doesn't appear in Eclipse?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM