0
爲什麼線性佈局不填滿整個屏幕?
正如你所看到的,我在線性佈局中使用匹配父項。
如果我刪除滾動條沒有任何變化。該按鈕不在屏幕的底部。
main_activity.xml:線性佈局不填滿整個屏幕
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context="com.sarahp.demo.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout ----------> HERE
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textview_demo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="32dp"
android:layout_marginTop="32dp"
android:text="@string/demo"
android:textSize="42dp"/>
<RelativeLayout
android:id="@+id/fragment_container_a"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:id="@+id/fragment_container_b"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@color/transparent"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
儘量給fragment_container_a,高度= 0和體重= 1 – Flo
仍有底部 –
的空間你怎麼想你佈局? –