提问者:小点点

当我在AndroidStudio中使用ScrollView时,布局中的所有内容都会向下移动


<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    tools:context=".view.characterlist.HaruActivity"
    android:background="@drawable/harubackgound"
    >

...


</RelativeLayout>

下面是没有滚动查看的屏幕图片:https://media.discordapp.net/attachments/473468257626488852/722442283181539409/unknown.png

这里有:https://media.discordapp.net/attachments/473468257626488852/722441710067777617/unknown.png

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context=".view.characterlist.HaruActivity"
    android:background="@drawable/harubackgound"
    >


   ...

</RelativeLayout>
</ScrollView>

有人能帮我吗? 泰


共1个答案

匿名用户

尝试将图像设置为背景,以便添加:

android:background = "@drawable/...

在父相对布局中。

我相信所有的textview都在下降,因为图像当前处于imageview中,如果您想将textview覆盖在图像上,那么您需要将image设置为背景。