【发布时间】:2015-02-11 06:49:10
【问题描述】:
我不想为我的布局需要(需要?)创建一个 FragmentStatePagerAdapter 成为顶层的 ScrollView。 现在,当我创建布局时,LinearLayout(或 RelativeLayout 无关紧要)从不使用完整的滚动视图容器,即使我将 layout_height 和 layoutg_width 设置为“match_parent”(fill_parent 或 wrap_content 也不起作用) 这是布局的一部分
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/intro_scroll_view_1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="vertical"
android:background="@drawable/intro_dummy">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".80"
android:layout_gravity="center_horizontal">
<ImageView
android:layout_width="223dp"
android:layout_height="60dp"
android:id="@+id/imageView"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:src="@drawable/logo"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".20"
android:layout_gravity="center_horizontal">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/button">
</RelativeLayout>
<Button
android:background="@null"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Get Started"
android:id="@+id/button"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:textColor="#ffffff"
android:padding="2dp"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
既然我使用了 match_parent 它应该使用整个屏幕吗?不,它只使用屏幕的随机位
如果我删除 Scrollview 并将 LinearLayout 设置为顶层元素,它会使用所有内容。所以我猜我在 Scrollview 描述中遗漏了一些东西来让它使用一切?
【问题讨论】: