【发布时间】:2014-08-24 08:56:12
【问题描述】:
我有一个图像视图,我想填充它的父级 RelativeLayout 以充当背景图像。
在相关布局中的其他视图展开之前,图像的大小是正确的,从而扩大了整个布局的大小(在我的情况下只是高度)(即:来自互联网的大字符串已加载到 textView )。然后图像视图不会增长以继续匹配父级。这是预期的行为吗?如果是,我们如何绕过它?
这是我的布局代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/parentLayout">
<my.BlurredImageView
android:scaleType="centerCrop"
android:id="@+id/profile_bg"
ImageUrl= "Avatar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
/>
<LOTS AND LOTS OF OTHER VIEWS>
【问题讨论】:
-
你怎么知道“图像视图没有增长”?
-
起初我猜它没有,因为添加项目后,图像仅覆盖了相对布局的 3/4。然后我在Android Monitor Layout View中查看,看到了对象的边界
标签: android android-layout android-relativelayout