简体   繁体   English

Eclipse不显示Android XML文件的图形布局

[英]Eclipse Not Showing Graphical Layout for Android XML files

I had a HD hardware failure the otherday and have been trying to recreate my Android programming environment. 前几天我遇到了HD硬件故障,并且一直试图重新创建我的Android编程环境。

I have installed Eclipse and the Android SDK. 我已经安装了Eclipse和Android SDK。 I have updated the SDK to the latest version. 我已将SDK更新到最新版本。

I then imported my project from my backup folder. 然后我从备份文件夹导入了我的项目。 When I look at my layout files in eclipse I cannot view the Grphical.layout as its not an option. 当我在eclipse中查看我的布局文件时,我无法查看Grphical.layout,因为它不是一个选项。 I get the following tab options for the page (Design or Source). 我得到页面的以下选项卡选项(设计或源)。

However my old environmet which i have a copy of in a virtual machine gives me following tab options for the layout file (Graphical Layout or filename.xml) 然而,我在虚拟机中拥有副本的旧环境为我提供了以下布局文件的选项卡选项(Graphical Layout或filename.xml)

Any ideas why this is occuring? 任何想法为什么会发生这种情况? I assume it must be something to do with eclipse not realising that its menat to be looking at android xml layout files. 我认为它必须与eclipse有关,没有意识到它的menat正在看android xml布局文件。

Please help, 请帮忙,

Iain 伊恩

漫画如果没有通过打开xml文件显示图形布局尝试在xml文件上使用OpenWith - >布局编辑器,你想从res文件夹下的项目浏览器打开

If the above answer doesn't work and if you cannot see the option of 'Layout Editor' on right click, restart eclipse. 如果上述答案不起作用,如果右键单击无法看到“布局编辑器”选项,请重新启动eclipse。 Worked for me. 为我工作。

有时图形布局show.but什么都没有显示。只是空白。这是因为清单最小sdk不支持查看布局。解决改变显示在布局显示区域右角的api级别。

I tried the option suggested by Muni, but did not work. 我尝试了Muni建议的选项,但没有奏效。 Then I noticed that the Android version in the Graphical Layout was higher than what I had selected for my project which was causing the issue. 然后我注意到图形布局中的Android版本高于我为项目选择的导致问题的版本。 After setting it to appropriate version it worked fine. 将其设置为适当的版本后,它工作正常。

I had same problem with ADT eclipse. 我和ADT eclipse有同样的问题。 Probably this happens when you change something with your editor like changing themes. 当您使用编辑器更改内容(例如更改主题)时,可能会发生这种情况。 Need not to worry about this, here I have solution for your issue it to navigate with your xml sourc and xml Layout files as for displaying Graphical Layout use this keyboard shortcut. 不用担心这个,这里我有你的问题的解决方案,用你的xml sourc和xml布局文件导航,就像显示图形布局一样使用这个键盘快捷键。 Shift+Alt+F7 and for navigating with source editor of xml file use this shortcuts as Alt+F7 Thanks for such good question. Shift + Alt + F7和使用xml文件的源编辑器导航使用此快捷键为Alt + F7感谢您提出这样的好问题。 hope my answer will useful for all those are stuck with this. 希望我的回答对所有坚持这一点的人都有用。

I was facing this problem but that didn't get corrected by restarting. 我遇到了这个问题但是没有通过重新启动来纠正。 Actually, my xml file say "MyFile.xml" was present in a sub folder of layout and in the layout folder itself(root). 实际上,我的xml文件说“MyFile.xml”出现在布局的子文件夹和布局文件夹本身(root)中。 When i opened "MyFile.xml" from the subfolder it just showed the code. 当我从子文件夹中打开“MyFile.xml”时,它只显示了代码。 When i opened "MyFile.xml" directly from the layout folder(not from itz sub folder), it showed both the design and code. 当我直接从布局文件夹(而不是从itz子文件夹)打开“MyFile.xml”时,它显示了设计和代码。

:p that was my blunder! :那是我的错误!

Just follow this pattern : Package Explorer ---> res --> Layout ---> activity_main.XML Open activity_main.XML 只需遵循以下模式:Package Explorer ---> res - > Layout ---> activity_main.XML打开activity_main.XML

May 2013 2013年5月

just open with regular xml editor and put them side by side. 只需使用常规xml编辑器打开并将它们并排放置即可。 'right click' open with xml editor, and drag it so the windows layout side by side. '右键单击'用xml编辑器打开,然后拖动它以使窗口布局并排。

My problem was that I installed everything and restarted eclipse. 我的问题是我安装了所有东西并重启了eclipse。 But I didn't go back to. 但我没有回去。 Window | 窗口| Android SDK manager. Android SDK管理器。

When I did that I saw that eventhough I had installed everything and the SDK worked just fine. 当我这样做时,我看到了这个事件,尽管我已经安装了所有内容并且SDK工作得很好。 There was another 3 packages left to install. 还剩下3个包安装。 I installed that (and some sample code). 我安装了(以及一些示例代码)。 Restarted Eclipse and everything worked like a charm. 重新启动Eclipse,一切都像魅力一样。

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. 这解决了我的问题。

From the upper right corner try a different "Android version to use when rendering layouts in eclipse". 从右上角尝试在eclipse中渲染布局时使用的不同“Android版本”。 (Small green android icon). (小绿色android图标)。 This worked for me. 这对我有用。

If you can't see "Android Layout Editor", 如果你看不到“Android Layout Editor”,
right click on an xml layout file and choose Open With | 右键单击xml布局文件,然后选择Open With | Android Common XML Editor then choose Graphical Layout tab. 然后,Android Common XML Editor选择Graphical Layout选项卡。

See here 看到这里

If the above solutions doesn't fix the problem , then remove the very first line that is autogenerated while creating the xml file and select some theme like "No Title Bar" or other. 如果上述解决方案无法解决问题,则在创建xml文件时删除自动生成的第一行,并选择“No Title Bar”等主题。 Your problem will be fixed. 你的问题将得到解决。

I am doing only 我只是在做

  1. WORKSPACE ALL CONTENT DELETE 工作区所有内容删除
  2. INSTALLED adt-bundle-windows-x86-20131030 USED 已安装的adt-bundle-windows-x86-20131030已使用
  3. ECLIPS DOUBLE CLICK ECLIPS双击

MY PROBLEM SOLVE 我的问题解决了

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

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