比 Eclipse 中更好的 Android XML 布局编辑器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3115509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
better Android XML Layout Editor than the one in Eclipse
提问by Nils
I'm searching for a better Android XML layout editor than the one in eclipse. Preferable placing items by drag and drop to the correct X/Y position. With the current editor I have to try out figures to place it at the exact position ... is there an easier way ? (RelativeLayout is used)
我正在寻找比 eclipse 更好的 Android XML 布局编辑器。最好通过拖放到正确的 X/Y 位置来放置项目。使用当前的编辑器,我必须尝试将其放置在确切位置的数字......有没有更简单的方法?(使用了相对布局)
采纳答案by Cristian
So far, the only editor you will find is: http://droiddraw.org/You can draw a layout from their webpage, since it's written in Java and they have an applet... or you can download it and use it locally. It has some nice features, like sending a test layout directly to a device.
到目前为止,您会找到的唯一编辑器是:http: //droiddraw.org/您可以从他们的网页中绘制布局,因为它是用 Java 编写的并且他们有一个小程序...或者您可以下载它并在本地使用它. 它有一些不错的功能,比如直接将测试布局发送到设备。
回答by dykzei eleeot
If DroidDraw is the only one option then I wouldn't consider it as answer. It bases everything on AbsoluteLayout which is deprecated. It's near impossible to implement any complex enough flexible layout with help of this tool, as result your solution won't be okay on different screen sizes..
如果 DroidDraw 是唯一的选择,那么我不会将其视为答案。它基于已弃用的 AbsoluteLayout 的所有内容。借助此工具几乎不可能实现任何足够复杂的灵活布局,因此您的解决方案在不同的屏幕尺寸上将无法正常工作。
回答by WallMobile
IntelliJ 12 has a much improved graphical interface over version 11. I prefer the IDE heavily over eclipse as I have found it much faster. The new graphical layout is very nice in this one.
与版本 11 相比,IntelliJ 12 的图形界面有了很大改进。相比 Eclipse,我更喜欢 IDE,因为我发现它要快得多。这个新的图形布局非常好。
回答by Bob
Layouts are just horrible. The gui is worse than the xml, but both are horible, sorry to the people who have put time and effort into it, but trying to get controls where you would like them on the screen is far more difficult than it ought to be. Not many Apps that I know of that require a plain left to right or top to bottom layout.
布局简直太可怕了。gui 比 xml 更糟糕,但两者都很糟糕,对那些投入时间和精力的人感到抱歉,但是试图在屏幕上你想要的地方获得控件比它应该的要困难得多。我所知道的需要从左到右或从上到下布局的应用程序并不多。
I know that the scheme is meant to be as none-specific as possible, with just enough information so that the device itself can layout the App for it's size. Rare are the cases where we can just leave it up to the device.
我知道该方案旨在尽可能不具体,只提供足够的信息,以便设备本身可以根据其大小来布局应用程序。很少有我们可以将其留给设备的情况。
Frankly a plain HTML/CSS layout is far better with much greater chance of success on multiple devices, and a lot easier for the developer.
坦率地说,简单的 HTML/CSS 布局要好得多,在多个设备上成功的机会更大,对开发人员来说也更容易。
So, orriginal poster, if your App can be a web app, then go with an Android web app. Familiar territory and all that.
因此,原始海报,如果您的应用程序可以是网络应用程序,那么请使用 Android 网络应用程序。熟悉的领域等等。
Alternatively, do your layouts in code. In Windows Apps I usually do my layouts in code anyway. On the Android, I do put my controls in the xml file with just the control type and it's ID.
或者,在代码中进行布局。在 Windows 应用程序中,我通常在代码中进行布局。在 Android 上,我确实将控件放在 xml 文件中,其中仅包含控件类型和 ID。
Then everything else is in code, the only magic you need now is to Detect the screen size which is explained here Android Detect Screen SizeRemember the 'Screen to DP' part.
然后其他一切都在代码中,你现在唯一需要的就是检测屏幕尺寸,这里解释了Android 检测屏幕尺寸记住“屏幕到 DP”部分。
Plus you have your resizing in a single function which you call for any orientation change.
另外,您可以在单个函数中调整大小,您可以调用该函数来进行任何方向更改。
Before people start screeming 'CPU over load!!!' Consider this, how many controls do you usually have on the screen at any one time? Well it is actualy between one and 4. Some exceptions obviously, look at every app on your device, remembering that on many of the Apps that have multiple controls, those are grouped as a single item. So our resizing of upto 4 controls does not take any more time than the system takes to work it out on an orientation change.
在人们开始尖叫“CPU 过载!!!”之前 考虑一下,您通常在任何时候在屏幕上有多少个控件?嗯,它实际上在 1 到 4 之间。显然有一些例外,请查看您设备上的每个应用程序,请记住,在许多具有多个控件的应用程序上,它们被分组为一个项目。因此,我们调整最多 4 个控件的大小不会比系统处理方向更改所需的时间多。
回答by stevebot
AndroidStudio has a layout editor as well, although it is not different than IntelliJ, as AndroidStudio is based on IntelliJ. Also, I have experienced numerous crashes with the AndroidStudio layout editor, while doing simple tasks like adding an EditText.
AndroidStudio 也有一个布局编辑器,虽然它与 IntelliJ 没有什么不同,因为 AndroidStudio 是基于 IntelliJ 的。此外,我在使用 AndroidStudio 布局编辑器时遇到过多次崩溃,同时执行添加 EditText 等简单任务。
The editor is visually nice though, when it works.
编辑器在工作时在视觉上很好。