【发布时间】:2016-03-28 03:34:36
【问题描述】:
我在这里看到了很多关于这个问题的答案,但没有一个真的对我有用(唯一的例外是底部填充,我认为这是一个丑陋的解决方法)。
我在 Fragment 的 LinearLayout 中有一个 ScrollView。内容的最后一行(左右)无法看到,因为它隐藏在按钮后面。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="domain.idiotic.no.majlen.jidelnicek.MainActivity$PlaceholderFragment"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/section_label"
android:layout_weight="0"
android:layout_gravity="center_horizontal" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/scrollView"
android:layout_weight="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listLayout">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView"
android:width="0px"
android:layout_weight="0.8" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView2"
android:width="0px"
android:layout_weight="0.2" />
</TableRow>
</LinearLayout>
</ScrollView>
</LinearLayout>
如果我删除“中文本”TextView,这个问题仍然存在,所以这不是导致它的视图。我尝试为所有应该拉伸的视图设置不同的 layout_heights 和 layout_weights,但到目前为止我还没有运气。
Demonstration of the issue described, all the items are supposed to be doubled
【问题讨论】:
-
嗯,什么
Buttons?为什么你有一个TableRow而没有TableLayout? -
我指的是安卓软按钮。
TableLayout没有改变任何东西。 -
如果您担心底部填充使用常量,您可以像这样以编程方式设置底部填充:stackoverflow.com/questions/8689117/…
标签: android android-fragments scrollview