0

Just to start, im not really looking for someone to code this out for me, i'm just trying to find a video or thread with a tutorial or explanation on how this is done, if it is even possible. I do not know what to search for.

I'm creating an app and within each activity i want to store information about a business with each Activity pertaining to each part of the business.

I have looked around and am not sure if there is a name for what i want to do so if someone knows or could point me in the correct direction i would appreciate it.

I want to have a few category buttons in a single activity. Each will have an image to the left of the view and the category name on the right, however i design it, i will figure that out on my own.

I am wondering however if there is a way to make it so when i click on the button, lets name this one Rates, for pricing. I want it to pull to the top of the screen (if its not at the top already) and have a drop-down under when clicked with a textview or table of the rates. then when i close it it returns to its original position, and all of these buttons do this.

Here is a picture of the idea i want to try:

enter image description here

Apologies if this is vague, i'm not really sure the best way to explain what i want to do. the XML side i understand but the java side i'm still learning as i go along. If this is not a good technique we can close the thread and i'll try something a little easier until i like the design.

Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
Spacemann
  • 11
  • 4
  • So you essentially want to change the position and visibility of a view when a button is pressed. Right? – Aryan Jan 13 '19 at 18:58
  • Yes, @Aryan ideally there will be a few buttons on the page, if a button is clicked a TextView will appear with the information i want, and when you click the button again it hides the TextView. The buttons should move when another button is clicked and takes the space up, then should return to its original position when the view closes. – Spacemann Jan 13 '19 at 19:02

1 Answers1

0

From what I understand, you're want to change the positions of views on your layout when a button is tapped. You can achieve this by setting onClickListeners on your buttons, and then using setLayoutParams{...} to alter the position of your layout elements.

How can I dynamically set the position of view in Android?

You can also use a flag to determine if the button is being tapped a second time and make the necessary changes to make the layout appear/disappear. You may also need to change the visibility of your elements using View.setVisibilty(View.GONE);

Aryan
  • 136
  • 1
  • 3
  • 17
  • I'll give it a read over and see what i can accomplish, thanks, you definitely just made it sound so much easier than i was making it out to be in my head. I found a tutorial about clicking buttons and showing/hiding textviews i can follow along to which looked like what i wanted in its basic form so i'll start there and see where this thread takes me. – Spacemann Jan 13 '19 at 19:14