RelativeLayout的问题 - 图像重叠滚动型 [英] RelativeLayout issue - image overlaps ScrollView
问题描述
我读了所有已经发布的相对布局问题,我想我注意到双问,对不起,如果我。
I read all the relative layout questions already posted and I guess I'm note double asking, sorry if I am.
我想我的应用程序的底部粘图像,上面我有一个滚动视图,就像这样:
I'm trying to stick an image in the bottom of my app, and above is I have a scrollview, like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/RelativeLayout1">
<ScrollView android:paddingTop="180dip" android:layout_width="fill_parent" android:id="@+id/scrollView12" android:layout_height="wrap_content">
<LinearLayout android:id="@+id/linearLayout4" android:layout_width="fill_parent" android:paddingRight="8dip" android:orientation="vertical" android:layout_height="wrap_content">
</LinearLayout>
</ScrollView>
<ImageView android:layout_width="fill_parent"
android:background="@color/cinza" android:src="@drawable/header"
android:id="@+id/imageView2" android:layout_height="wrap_content" android:layout_alignParentBottom="true">
</ImageView>
</RelativeLayout>
我喂滚动视图dinamically,所以它的大小可以改变。我的问题是,如果它生长,直到显示屏的结束,最后的记录进入我的照片之后。我希望它只是成长直到画面。
如何做到这一点的一些线索?我试了几种方法,relativelayouts,linearlayouts,但有时画面消失,有时并不在底部粘...
希望我的问题是清楚的。
I feed the scrollview dinamically, so the size of it can change. My problem is that if it grows till the end of the display, the last records goes behind my picture. I wanted it to grow just untill the picture. Some clue on how to do this? I tried several ways, relativelayouts, linearlayouts, but sometimes the picture disappears, sometimes don't stick in the bottom... Hope my question was clear.
由于提前,
若昂
推荐答案
您应该只需要添加的android:layout_above =@ + ID / imageView2
的滚动型,以及首先定义ImageView的,因为你希望它是先画,然后滚动型中的 RelativeLayout的
。
You should just add android:layout_above="@+id/imageView2"
for the ScrollView, and define the ImageView first, as you want it to be draw first, then the ScrollView inside the RelativeLayout
.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/RelativeLayout1">
<ImageView
android:layout_width="fill_parent"
android:background="@color/cinza"
android:src="@drawable/header"
android:id="@+id/imageView2"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
</ImageView>
<ScrollView
android:paddingTop="180dip"
android:layout_width="fill_parent"
android:id="@+id/scrollView12"
android:layout_above="@+id/imageView2"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="fill_parent"
android:paddingRight="8dip"
android:orientation="vertical"
android:layout_height="wrap_content">
</LinearLayout>
</ScrollView>
</RelativeLayout>
这篇关于RelativeLayout的问题 - 图像重叠滚动型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!