I used the ViewFlipper element to display tweets with a continuous interval from left to right . I added dynamic text for each tweet in ViewFlipper.
Everything works well, but sometime the text overlaps. 
What is the reason for this strange behavior?
code:
for (int i = 0; i < tweets.length(); i++) { tweet = tweets.getJSONObject(i).getString("title")+" tweet on "+tweets.getJSONObject(i).getString("pubDate"); tv = new TextView(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT); params.weight = 1.0f; params.gravity=48; tv.setLayoutParams(params); tv.setGravity(Gravity.CENTER); tv.setTextSize(22); tv.setTextColor(ColorStateList.valueOf(Color.WHITE)); tv.setSingleLine(); //tv.setTextColor(getREs) tv.setText(tweet); flipper.addView(tv); } flipper.setInAnimation(inFromRightAnimation(1500)); flipper.setOutAnimation(outToLeftAnimation(1500)); flipper.startFlipping(); public static Animation inFromRightAnimation(int duration) { Animation inFromRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f ); inFromRight.setDuration(duration); inFromRight.setInterpolator(new AccelerateInterpolator()); return inFromRight; } public static Animation outToLeftAnimation(int duration) { Animation outtoLeft = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f ); outtoLeft.setDuration(duration); outtoLeft.setInterpolator(new AccelerateInterpolator()); return outtoLeft; }
EDIT :
Here is another snapshot that shows the above problems.

user1423617
source share