I have a LinearLayout, I am dynamically adding TextView, ImageView to that LinearLayout
, now I have added OnClickListener to these TextViews and ImageViews.
I have an arraylist which has 10 items in it, using a for loop I am getting each value and displaying, since it's quiz app I have next and previous buttons, when I click on that I am displaying items one by one from the arraylist.Now I need slide In and slide Out animation to apply to this Linear Layout.
I have seen this :
and also I have tried this
slideIn = new TranslateAnimation(
TranslateAnimation.RELATIVE_TO_PARENT, 1.0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0.0f);
slideIn.setDuration(500);
slideOut = new TranslateAnimation(
TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
TranslateAnimation.RELATIVE_TO_PARENT, -1.0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0.0f);
slideOut.setDuration(500);
But not working please help on this.
EDIT:
Problem: I have applied this to the linear layout but what happens is that when i click on next button current question will slide left and a blank screen then it will slide in and display next question, but I want as soon as the current question slides out it should be followed by next question.