Android 并非所有视图都在滚动

Android 并非所有视图都在滚动,android,android-layout,android-scrollview,Android,Android Layout,Android Scrollview,很抱歉,即使咨询了SO解决方案,我仍在继续: 1. 2. 3. 4-等等 我的情况如下: [-主题----------------] [-标签----------------] [-参与者--] {邮件消息1} {邮件消息2} {邮件消息3} 当前行为:当我滚动时,{mail messages}向上移动,但[Subject Labels Participants]保持作为固定标题 期望的行为:当我滚动时,[主题标签参与者]和{messages}作为一个优雅的单元移动,滚动出视图,就像神奇的独角兽

很抱歉,即使咨询了SO解决方案,我仍在继续: 1. 2. 3. 4-等等

我的情况如下:

[-主题----------------]

[-标签----------------]

[-参与者--]

{邮件消息1}

{邮件消息2}

{邮件消息3}

当前行为:当我滚动时,{mail messages}向上移动,但[Subject Labels Participants]保持作为固定标题

期望的行为:当我滚动时,[主题标签参与者]和{messages}作为一个优雅的单元移动,滚动出视图,就像神奇的独角兽在日落中跳舞一样

代码


为什么要为每个视图使用单独的布局?是否尝试将所有视图添加到单个相对布局?

如果需要

期望的行为:当我滚动时,[主题标签参与者]和{messages}作为一个优雅的单元移动,滚动出视图,就像神奇的独角兽在日落中跳舞一样

然后将所有内容放入1个相对视图,在1个滚动视图中

e、 g


我认为我们可能需要完整的xml,因为您所拥有的一切看起来都应该滚动。这里是滚动视图?也许给我们看完整的实际布局?请输入原始布局代码。查看视图上设置的其他属性,如layout_width和layout_height,这一点很重要。@GreybeardGeek它现在就在那里。它漏了一条线!听起来不错,谢谢,我们在下面的列表中填充电子邮件的方式其实很奇怪,所以我们重新连接了java,但是你的答案完全可以。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true">

        <RelativeLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="75dp"
        android:orientation="vertical">

        <TextView
        android:id="@+id/subject"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="10dp"
        android:paddingLeft="13dp"
        android:text="Subject"
        android:textSize="20sp"
        android:textStyle="bold" />

    <RelativeLayout
        android:id="@+id/labels_row"
        android:layout_below="@id/subject"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="4dp"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/labels_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="2dp"
            android:layout_marginLeft="17dp"
            android:src="@drawable/label" />

        <TextView
            android:id="@+id/labels"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="44dp"
            android:text="Labels" />

    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/participants_row"
        android:layout_below="@id/labels_row"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="4dp"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/participants_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="2dp"
            android:layout_marginLeft="13dp"
            android:src="@drawable/participants" />

        <TextView
            android:id="@+id/participants"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="44dp"
            android:text="Participants" />

    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/mails"
        android:layout_below="@id/participants_row"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

                </RelativeLayout>



</ScrollView>

    <RelativeLayout
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="25dp"
        android:gravity="center" >

        <ImageButton
            android:id="@+id/compose_reply"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/text_reply" />

        <View
            android:id="@+id/reply_divider"
            android:layout_toRightOf="@id/compose_reply"
            android:layout_width="1dp"
            android:layout_height="48dp"
            android:layout_marginTop="1dp"
            android:layout_marginRight="-1dp"
            android:layout_marginBottom="1dp"
            android:layout_marginLeft="-1dp"
            android:background="#CED0D1" />

        <ImageButton
            android:id="@+id/voice_reply"
            android:layout_toRightOf="@id/reply_divider"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/voice_input" />

        <Spinner
            android:id="@+id/touch_reply"
            style="?android:attr/buttonStyleSmall"
            android:layout_toRightOf="@id/voice_reply"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </RelativeLayout>

</RelativeLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

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


        More Views

        More Layouts

        More Views

        More Layouts


    </RelativeLayout>

</ScrollView>