0
I’m changing the height of a LinearLayout
of WRAP_CONTENT
for 0
(zero) and vice versa listening to the event onClick
of a Button
.
I would like this change to occur gradually over a few milliseconds, like 700ms
, for example. How do I do this using as little code as possible?
Excerpt from the code:
LinearLayout ll = (LinearLayout) findViewById(R.id.teste);
ll.setOnClickListener(new View.onClickListener() {
@Override
public void onClick (View v){
ViewGroup.LayoutParams params = v.getLayoutParams();
params.height = 0;
v.setLayoutParams(params);
}
});
This changes the height to zero, but no transition.
EDITED: The effect is similar to that link but vertically
I would recommend using
ObjectAnimator
orViewPropertyAnimator
, or even the attributeanimateLayoutChanges
, nothingThreads
:P But really, if the relevant code where you are making this modification gets complicated help.– Wakim
It’s because I’m only changing the height of Linearlayout, so I didn’t add code... I’ll add
– Jhonatan Pereira
Blz, I’ll give you a hint as soon as I put in the code.
– Wakim
In the code I am testing with Click on the element itself, then I will only change this Click to a button, but with the effect in Linearlayout.
– Jhonatan Pereira