I want to reverse the direction of marquee in the TextView. By default, the text moves from Right to Left, I want it to move from Left to Right. How can I do this?
For right to left text for every one to use: try this:
TextView tv = (TextView) findViewById(R.id.txt);
Rect bounds = new Rect();
Paint textPaint = tv.getPaint();
String text = tv.getText().toString();
textPaint.getTextBounds(text, 0, text.length(), bounds);
int width = bounds.width();
LinearLayout.LayoutParams lp = (LayoutParams) tv.getLayoutParams();
lp.width = width + 100;
int startX = 300;
TranslateAnimation ta = new TranslateAnimation(startX, lp.width, 0, 0);
ta.setDuration(20000);
ta.setRepeatCount(-1);
tv.setAnimation(ta);