I'm developing an m3u livestreaming app, and I want to show all of the channels in a listview. Now I don't know how to make a listview appear from the right as shown in the picture with a slide animation when a button is clicked and make it disappear (slide out animation) when I click the button again.
Can somebody help me out ?picture of what I want to achieve
Edit: I tried this, but it didn't work unfortunately.
//slide in imgbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imgbuttonisclicked = true;
ValueAnimator widthAnimator = ValueAnimator.ofInt(0, 255);
widthAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int animatedValue = (int) animation.getAnimatedValue();
list.getLayoutParams().width = animatedValue;
list.requestLayout();
}
});
//slide out if (imgbuttonisclicked){
widthAnimator = ValueAnimator.ofInt(255, 0);
widthAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int animatedValue = (int) animation.getAnimatedValue();
list.getLayoutParams().width = animatedValue;
list.requestLayout();
}
});
}
}
});