I am starting to work with Android Studio and I am having some problems without my activity.
I would like to represent a layout, and after clicking on it, I would like to increase the size of it.
I think that MaterialDesign has a way to do that, but I do not really know how to do it.
I will explain it better with a couple of images:
- Before than clicking on it
- After clicking on it
The pictures are made by photoshop, not by coding.
So, what I want to do is to increase the size by the middle of the layout, like in the picture.
I was wondering if someone of you knows how to do it.
Thank you.
2
Answers
I finally got the solution. Just adding to the
layout
that you want to expand or collapse (and to any of the previouslayouts
) the following lineand working with the visibility of the
layout
you would be able to expand it or collapse it.Simple method, and it actually works.
[EDITED]
The main point of the solution if that you have to code some differents views. Some of the are hidden, and some of them are shown.
The code needed is the followed:
Java Method required to show and hide all the views
public class Principal_Activity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
}
XML
It’s not “basically”, sorry.
The idea is to divide your layout into 3 pieces – ex. top, middle, bottom – and animate “middle” size change. Maybe, middle piece visibility change will also be needed.
The realization may be rather hard, especially if you wish to scroll it back on second click.
My own attempt was based on this example – https://github.com/Udinic/SmallExamples/tree/master/ExpandAnimationExample