I. *_*. A 5 android textview android-nestedscrollview
我有NestedScrollView一个ScrollView。在NestedScrollView包含TextView。因此,当TextView展开超过4或n个 lineas时,我需要制作它Scrollable TextView。
任何帮助深表感谢!!
小智 0
我希望你现在已经解决了这个问题。如果以后有人找的话,就不需要设置最大高度了。只需将 NestedScrollView 的高度设置为 37f,只要文本大小超过 37,NestedScrollView 就会开始滚动。
xml:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
...
</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)
或以编程方式:
NestedScrollView nsv = new NestedScrollView(getActivity());
// Initialize Layout Parameters
RelativeLayout.LayoutParams nsvParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 38));
// Set Layout Parameters
nsv.setLayoutParams(nsvParams);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1081 次 |
| 最近记录: |