我在這裏看到了很多關於這個問題的答案,但沒有一個真正爲我工作(唯一的例外是底部填充,我認爲這是一個醜陋的解決方法)。ScrollView被底部按鈕欄截斷
我在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
嗯,什麼'按鈕'?爲什麼你有沒有'TableLayout'的'TableRow'? – Sourabh
我的意思是android軟件按鈕。 'TableLayout'沒有改變任何東西。 – Majlen
如果你擔心底部填充使用常量,你可以像這樣以編程方式設置底部填充:http://stackoverflow.com/questions/8689117/dimension-of-soft-buttons-bar – Gi0rgi0s