Android框架布局与独立的内部滚动并排

Android框架布局与独立的内部滚动并排,android,android-layout,android-fragments,scrollview,Android,Android Layout,Android Fragments,Scrollview,我正在尝试设置一个平板电脑布局,左边是列表,右边是详细信息窗格。单击列表项时,详细信息窗格将填充一系列比左侧列表长的卡片。我希望详细信息窗格和列表(回收器视图)能够独立于其中一个和另一个进行滚动,但我不知道如何做到这一点 这是我的main_content.axml-recyclerview被加载到framelayout listcontainer中,详细信息被放置到detailscontainer中(在此之前textview被删除)-但两个框架仍然“作为一个”滚动-整个应用程序滚动,框架不会单独

我正在尝试设置一个平板电脑布局,左边是列表,右边是详细信息窗格。单击列表项时,详细信息窗格将填充一系列比左侧列表长的卡片。我希望详细信息窗格和列表(回收器视图)能够独立于其中一个和另一个进行滚动,但我不知道如何做到这一点

这是我的main_content.axml-recyclerview被加载到framelayout listcontainer中,详细信息被放置到detailscontainer中(在此之前textview被删除)-但两个框架仍然“作为一个”滚动-整个应用程序滚动,框架不会单独滚动

另外,main_content.xml包装在nestedscrollview中,因此我可以使用折叠工具栏-您可以在此处看到main.xml:


编辑,为清晰起见,以下是加载到列表框中的内容:--以下是加载到详细信息窗格中的内容:

编辑2:下面的图片显示了列表和细节这两个帧应如何独立于其中一帧和另一帧进行滚动,即当您滚动细节时,列表不应移动,当您滚动列表时,细节不应移动:


使用
线性布局,而不是
滚动视图
子视图中的
框架布局
,它会工作!或者在
ScrollView

xml示例:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <ScrollView
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_weight="1">
        <LinearLayout
            android:orientation="vertical"
            android:id="@+id/listcontainer"
            android:layout_weight="1"
            android:layout_width="450dp"
            android:layout_height="match_parent" >
            <LinearLayout
                android:background="#897"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
            <LinearLayout
                android:background="#127"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
            <LinearLayout
                android:background="#908"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
        </LinearLayout>
    </ScrollView>

    <View android:layout_height="fill_parent"
        android:layout_width="1dp"
        android:background="?android:attr/listDivider"/>

    <ScrollView
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_weight="2">
        <LinearLayout
            android:orientation="vertical"
            android:id="@+id/listcontainerTwo"
            android:layout_weight="1"
            android:layout_width="450dp"
            android:layout_height="match_parent" >
            <LinearLayout
                android:background="#897"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
            <LinearLayout
                android:background="#127"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
            <LinearLayout
                android:background="#908"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
        </LinearLayout>
    </ScrollView>

</LinearLayout>


FrameLayout只是一个容器,如果您使用
LinearLayout
无论如何它都会滚动,大多数情况下ScrollView场景都会出现问题,我已经测试过了。您可以找到微笑者问题>

您好,您可以添加一个带有颜色的图像吗understand@Charuක - 我在底部添加了它,希望它能让事情变得更简单:D我的建议是什么?我回答了你的答案,它不起作用:(这不起作用,两个scrollview一起滚动,好像它没有注册该部分是可滚动的:(可能是因为整个main_content.axml在嵌套的scrollview中被扭曲了吗?请看这里:@Joe Brailsford首先你能检查我的输出并告诉我这就是你要找的吗?是的,这正是我要找的for@JoeBrailsford这是我回答中的布局好吧,那让我看看你的主要内容
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <ScrollView
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_weight="1">
        <LinearLayout
            android:orientation="vertical"
            android:id="@+id/listcontainer"
            android:layout_weight="1"
            android:layout_width="450dp"
            android:layout_height="match_parent" >
            <LinearLayout
                android:background="#897"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
            <LinearLayout
                android:background="#127"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
            <LinearLayout
                android:background="#908"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
        </LinearLayout>
    </ScrollView>

    <View android:layout_height="fill_parent"
        android:layout_width="1dp"
        android:background="?android:attr/listDivider"/>

    <ScrollView
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_weight="2">
        <LinearLayout
            android:orientation="vertical"
            android:id="@+id/listcontainerTwo"
            android:layout_weight="1"
            android:layout_width="450dp"
            android:layout_height="match_parent" >
            <LinearLayout
                android:background="#897"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
            <LinearLayout
                android:background="#127"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
            <LinearLayout
                android:background="#908"
                android:layout_width="match_parent"
                android:layout_height="300dp"></LinearLayout>
        </LinearLayout>
    </ScrollView>

</LinearLayout>