我在NestedScrollView
内有一个ScrollView
。 NestedScrollView
包含TextView
。因此,当TextView
扩展到4或n线以上时,我需要使它成为Scrollable TextView
。
任何帮助深表感谢!!
我希望你现在必须解决这个问题。如果将来有人查找,您无需设置最大高度。只需将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>
或以编程方式:
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);