1
因此,我有一个ImageView里面的FrameLayout。我需要这样。我觉得这里的问题是图像,它的大小本身。图像的布局将屏幕上的所有其他视图向下推进,留下应该来自布局的相当大的空白空间。布局按下屏幕
我发现硬编码的高度值让我最小化这个问题。如果高度是wrap_content,图像将达到同一点,但应该从布局中获得的空白空间会延伸到极长的长度。
所以我想知道这是一个图像大小(或分辨率?)问题(似乎是)或其他任何东西,并且如果有比硬编码布局高度更好的解决方案。提前致谢。
下面是代码:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="700dp">
<ImageView
android:id="@+id/image_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:src="@drawable/me_and_gundam" />
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient" />
</FrameLayout>
<TextView
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="My Nanodegree Apps!"
android:textAlignment="center"
android:textSize="24sp" />
,这里是什么样子:
不,它不起作用。 – Karnkuret