Belgi
Belgi

Reputation: 15062

Android: How can I use the space from objects with visibility GONE?

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.

Upvotes: 1

Views: 256

Answers (2)

Moog
Moog

Reputation: 10193

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

Upvotes: 1

Ahmed Salem
Ahmed Salem

Reputation: 3969

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

Upvotes: 2

Related Questions