Android:如何使用可见性消失的对象的空间?

发布于 2024-12-09 06:43:19 字数 348 浏览 0 评论 0原文

当我尝试在 Eclipse 中使用图形布局界面(而不是 xml)进行布局时,我遇到了这个问题:

假设我的主布局只是屏幕底部的一个简单按钮, 单击该按钮时,会打开一个覆盖大部分屏幕的文本框。

注意:我这样做是将文本框的可见性从“消失”设置为“可见”(当我想隐藏文本框时则相反)。

现在(文本框被隐藏)我想使用我拥有的额外空间并向主布局添加一个按钮。 通常这不是什么大问题,但由于我的文本框几乎覆盖了图形布局中的整个屏幕,因此我在这样做时遇到了很多麻烦(这只是一个例子,我想添加更复杂的东西到我新获得的空间)。

我能做些什么 ?在图形布局中,我无法隐藏对象(如文本框或按钮),我将另一个按钮拖动到我可以看到/使用它的空间。

When I try to make a layout while working with the graphical layout interface in Eclipse (and not the xml) I came across with this problem:

Let's say that my main layout is only a simple button on the bottom of the screen,
when clicked the button opens up a text box that covers most of the screen.

note : I do this be setting the visibility of the text box from GONE to VISIBLE (and the other way around when I want to hide the text box).

Now (the text box is hidden) I want to use the extra space I have and add a button to the main layout.
normally this isn't much of a problem but since I have the text box covering almost the entire screen in the graphical layout I'm having a lot of trouble doing so (and this is just an example, I want to add more complicated things to my new gained space).

What can I do ? in the graphical layout I can't hide an object (like text box or button) and I drag another button to that space I can see/work with it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

燕归巢 2024-12-16 06:43:19

设计布局时将 android:visibility 属性设置为 "gone"

set the android:visibility attribute to "gone" while designing the layout

疯狂的代价 2024-12-16 06:43:19

你对这一切的看法都是错误的。

您应该使用新活动或对话框来创建覆盖整个屏幕的文本框,或使用 ViewFlipper 来创建活动的多个视图。

看来您想从一种布局中完成此操作,因此 ViewFlipper 将是这里最简单的选择。

该文档位于通常的位置:

http://developer.android.com/参考/android/widget/ViewFlipper.html

一些示例可以在以下位置找到:

http://www.androidpeople.com/android-viewflipper-example

http://android-pro.blogspot.com/2010/09/using-view-flipper-in-android.html

编辑< /strong>

你的问题不是很清楚,所以我试图根据所提供的信息向您提供我的最佳猜测。也许您在这里尝试做的事情的图表可能更容易理解。尽管正如我所说,新活动或对话框可能会更好。因此,您还可以考虑使用对话框方法:

http://www.androidsnippets.com/prompt-user-input-with-an-alertdialog" rel="nofollow">http://www. androidsnippets.com/prompt-user-input-with-an-alertdialog

You are going about this all wrong.

You should be using either a new activity or a diloag box to create a textbox that covers the entire screen or a ViewFlipper to create multiple views on your activity.

It appears that you want to do it from one layout so ViewFlipper would be the simplest choice here.

The documentation is available in the usual place:

http://developer.android.com/reference/android/widget/ViewFlipper.html

Some examples can be found at:

http://www.androidpeople.com/android-viewflipper-example

http://android-pro.blogspot.com/2010/09/using-view-flipper-in-android.html

EDIT

Your question isn't very clear so I have tried to give you my best guess from the information provided. Perhaps a diagram of what you are trying to do here might be more easily understood. Though as I stated a new activity or a dialog box might be better. So you could also look at using a dialog method:

http://www.androidsnippets.com/prompt-user-input-with-an-alertdialog

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文