【发布时间】:2017-01-25 03:28:09
【问题描述】:
为什么线性布局没有填满整个屏幕?
如您所见,我在线性布局中使用匹配父级。
如果我删除滚动条没有任何改变。该按钮不在屏幕底部。
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,height = 0 and weight = 1
-
底部还有空格
-
你想要怎样的布局?
标签: android xml layout fragment