相关疑难解决方法(0)

ImageView不会填充父级

我的一个屏幕上有一个ScrollView.我希望右边有阴影.我决定最简单的方法是让ScrollView的子项成为RelativeLayout,并有两个RelativeLayout的子项 - 一个是LinearLayout,它将容纳屏幕的布局,第二个View是阴影.

像这样......

<ScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:scrollbars="none" >

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >

                <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical" >
                <!-- stuff -->
                </LinearLayout>

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="fill_parent"
                    android:src="@drawable/shadow"
                    android:layout_alignParentRight="true"
                    />
            </RelativeLayout>
        </ScrollView>
Run Code Online (Sandbox Code Playgroud)

不幸的是,这不太有效.ImageView强制其尺寸为图像文件的大小.它不会垂直拉伸成RelativeLayout的高度.我也试过"match_parent"无济于事.图像是9补丁.

想法?

android scrollview relativelayout

8
推荐指数
2
解决办法
2万
查看次数

标签 统计

android ×1

relativelayout ×1

scrollview ×1