Android TextView with scrollbars and maxHeight

后端 未结 1 1949
甜味超标
甜味超标 2020-12-05 18:19

I need to set the TextView maximum height (either using maxHeight or maxLines). And if there are more lines of text the scrollbars should be shown. What markup should I use

1条回答
  •  一生所求
    2020-12-05 18:47

    Layout:

    
    
    

    Code:

    TextView textView = (TextView)findViewById(R.id.text_view);
    textView.setMovementMethod(ScrollingMovementMethod.getInstance());
    

    Note:

    The android:textColor="@android:color/secondary_text_dark_nodisable" is used to avoid text fade out when textView is touched.

    0 讨论(0)
提交回复
热议问题