我在我的应用程序中有一个活动,我希望用户能够垂直滚动LinearLayout
中包含的内容,而该内容又位于ScrollView
之内。这里是什么这项活动布局XML看起来像一个总结:LinearLayout在ScrollView Android中被切断
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dip"
android:orientation="vertical">
<!-- a bunch of standard widgets, omitted for brevity -->
<!-- everything renders but starting in this TextView -->
<!-- content begins to get truncated -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:gravity="left"
android:textSize="20dip"/>
<!-- this View, really just a trick for a horizontal row, is -->
<!-- completely cutoff -->
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@color/green" />
</LinearLayout>
</ScrollView>
</LinearLayout>
我所观察是在内部LinearLayout
内容正被该ScrollView
内侧截止。在上面的最后TextView
中,当它包含很少的文本时,那么它下面的View
会以纵向渲染,但不会横向渲染。当这个TextView
包含大量文本时,它会在纵向模式下截断。
我尝试了我在Stack Overflow上找到的建议。将底部填充添加到ScrollView
不能解决问题,也不会将ScrollView
替换为NestedScrollView
。
任何有用的建议将受到欢迎。这实际上是一个阻碍者。
添加屏幕截图 –
@OussemaAroua除非绝对必要,否则我宁愿不分享屏幕截图。你为什么认为这会有所帮助?基本上你会看到我在问题中描述的内容,除了底部的一些东西正在被切断。我希望你能看到我看不到的缺陷。 –
尝试将一些内部视图高度设置为match_parent,例如LinearLayout的 – stan0