Sunday, 9 June 2019

Dynamic Textview scrollbar not showing

I have created a textview dynamically and want to make it scrollable.

final RelativeLayout.LayoutParams params = parseLayoutParams(
                frameMargins, context);
tv.setText(Utility.getpropertyString(controls.getText()));
final String textColor = Utility.getpropertyString(controls.getTextcolor());
tv.setTextColor(Color.parseColor(textColor));
tv.setTextSize(12);
tv.setGravity(Gravity.CENTER_VERTICAL);
tv.setTextSize(tSize);
tv.setEllipsize(TextUtils.TruncateAt.END);
tv.setMaxLines(controls.getMaxlines());
tv.setTag(controls.getTagId());
tv.setLayoutParams(params);
tv.setEllipsize(TextUtils.TruncateAt.END);
tv.setVisibility(controls.getVisibility());
tv.setVerticalScrollBarEnabled(isScrollable);
tv.setScroller(new Scroller(context));
tv.setMovementMethod(new ScrollingMovementMethod());         
tv.setScrollBarFadeDuration(0);

But I am not able to see scrollbar in the textview niether when not scrolling nor when we scroll it. Please help!



from Dynamic Textview scrollbar not showing

No comments:

Post a Comment