如何在Eclipse中重新安排按钮的位置?[英] How do you rearrange buttons where you want them in Eclipse?

本文是小编为大家收集整理的关于如何在Eclipse中重新安排按钮的位置?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

大家好,我在将按钮放在XML布局中遇到麻烦.我已经有一个背景,只是试图在中间放置3个按钮,那就是我遇到麻烦的地方.我知道中心重力等等,但是您能帮我吗?另外,如果我自己制作按钮,我可以使用图像按钮的东西导入它们,还是不对?感谢您的帮助!

ps:另外,我的按钮周围还有一个大白色盒子.我该如何消失?

推荐答案

我将此答案发布到您的 ,所以我也会在这里发布. :)

您可以通过直接编辑XML或拖放和删除轮廓视图或图形布局视图来重新布置布局的元素(我发现后者更难可靠).

要使用您的自定义视图,请单击图形布局调色板中的"自定义和库视图"按钮,或者仅在XML中输入完全合格的类名称为视图标签.

其他推荐答案

如果使用图像按钮,则可以将自定义图像设置为SRC属性或背景属性.如果您选择了SRC,则应添加Android:background ="@null".

但是,如果您使用9 patch PNG(谁知道,您将使用9点),我建议使用背景属性,如果您将其设置在SRC中.

.

本文地址:https://www.itbaoku.cn/post/102394.html

问题描述

Hey guys I am having trouble with placing my buttons in my XML layout. I already have a background and was just trying to put 3 buttons near the middle and thats where I'm having trouble. I know about center gravity and all that but could you help me? Also, If I made my own buttons can I just import them using the image button thing, or is that not right? Thanks for the help!

PS: Also, there is a big white box around my button. How do I get that to go away?

推荐答案

I posted this answer to your duplicate question, so I'll also post it here. :)

You can rearrange elements of your layout by editing the XML directly or by dragging and dropping in the outline view or the graphical layout view (I find the latter harder to do reliably).

To use your custom views, click on the "Custom & Library Views" button in the graphical layout palette, or just type in the fully qualified class name as the view tag in the XML.

其他推荐答案

If you use Image button you can set your custom Image to src property or background property. If youi chose src you should add android:background="@null".

But I would recommend to use background property while if you use 9-patch png (who knows maybe tomorow you will use 9-patch) they would not stretch if you set it in src.