Trying to populate an textview(s) from an array. I managed to get the desired effect via XML via the code below
Try this.
final RelativeLayout relativeLayout = new RelativeLayout(this);
final RelativeLayout relativeLayoutbotombar = new RelativeLayout(this);
textView = new TextView(this);
textView.setId(1);
RelativeLayout.LayoutParams relativlayparamter = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT);
RelativeLayout.LayoutParams relativlaybottombar = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
relativeLayoutbotombar.setLayoutParams(relativlaybottombar);
textView.setText("text text text text text, with a long ");
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setSelected(true);
textView.setSingleLine(true);
relativeLayout.addView(relativeLayoutbotombar);
relativeLayoutbotombar.addView(textView);
setContentView(relativeLayout, relativlayparamter);
Another option:
TextView textView = (TextView) this.findViewById(R.id.xxx);
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setText("Text text text text");
textView.setSelected(true);
textView.setSingleLine(true);
Try this.. It work
TextView testing = (TextView) this.findViewById(R.id.testing);
testing.setEllipsize(TextUtils.TruncateAt.MARQUEE);
testing.setMarqueeRepeatLimit(-1);
testing.setSingleLine(true);
testing.setSelected(true);