0

I am doing a registration page coding. For that i have so many fields like name, surname, gender, DOB, user name, password, Address1, Address2, city, state, country, zip etc.. In this the Address fields are optional. So my question is, Is it possible to put a button and on click the button only optional fields are visible.

I tried using Scrollview, but i don't think it is the right option. Can anyone please help me in doing this. Thank you

wolverine
  • 1,665
  • 5
  • 24
  • 43

3 Answers3

0

You can make each field visible, invisible, or gone. You can define a button that changes the visibility of your fields. You find more info on the androoid developers reference pages, search for "View.visible".

Christine
  • 5,617
  • 4
  • 38
  • 61
  • Thank you for response, I need something like expandable list view. – wolverine Jun 08 '12 at 04:49
  • Expandable list view would work, I guess. Alternatively, you could check if the extra fields should be displayed in the getView() of the list adapter. – Christine Jun 08 '12 at 04:58
0

You can achieve this by using ScrollView also but you have to manage the optional field's visiblity as VISIBLE or GONE. On clicking the expand button set the views visibility as VISIBLE and by default set their visibility as GONE. You may add animation effect to them for collapsing and expanding effect.

Animesh Sinha
  • 1,045
  • 9
  • 16
  • How can i add animation? i am new to this topic – wolverine Jun 08 '12 at 05:06
  • you can find the animation example in DemoApp sample application or the same Question is asked in the http://stackoverflow.com/questions/4946295/android-expand-collapse-animation – Animesh Sinha Jun 08 '12 at 05:18
0

Make in your layout all optional elements with visibility = visible for a while, then sort and arrange your view as you need, after this, set the "optional" Gui Elements to visibility = gone, in the relativeLayout make this: android:animateLayoutChanges="true" and then play in the activity class with the optinal elements by hidding it or not

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97