LinearLayout的最大高度是多少?

bun*_*hes 7 layout android android-linearlayout

我有一个垂直线性布局,不会超出一定限度.

这是在imageview http://tinypic.com/r/20nm6s/5中使用centerCrop的布局

这是没有裁剪设置的布局(所以它应该是全宽和巨大的) http://tinypic.com/r/vzk7kw/5

所以我的想法是,在我的布局中我没有看到一些隐含的最大高度,但我看不到它在哪里,你能发现我的错误吗?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            >
    <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:background="@drawable/dropshadow"
            >
        <TextView
                android:id="@+id/heading"
                android:layout_gravity="center"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                />
        <ImageView
            android:id="@+id/featuredimage"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:maxHeight="1000dp"
            android:scaleType="centerCrop"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            />
    </LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

Geo*_*its 2

布局的“隐式”最大高度是其父级的高度。由于您在两种布局上使用wrap_content,这意味着父级实际上是屏幕区域,减去您正在使用的任何其他视图(例如 )TextView。除非将其放置在滚动容器中,例如ScrollView,否则它永远不会超过屏幕的大小。

ImageView当您删除裁剪时,您没有显示“全宽和巨大”的原因是因为scaleTypean 的默认值ImageViewfitCenter. 此特定视图受布局宽度的限制,因此它会在保持纵横比的同时缩小图像。