Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:水平和垂直滚动recyclerview_Android_Scrollview_Android Recyclerview_Horizontalscrollview_Vertical Scrolling - Fatal编程技术网

Android:水平和垂直滚动recyclerview

Android:水平和垂直滚动recyclerview,android,scrollview,android-recyclerview,horizontalscrollview,vertical-scrolling,Android,Scrollview,Android Recyclerview,Horizontalscrollview,Vertical Scrolling,我试图同时实现回收器视图的水平和垂直滚动。我必须显示一个包含8列的表,因此我计划同时实现水平和垂直滚动 我尝试了水平滚动视图,但它在一行中水平滚动 list_row.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" andr

我试图同时实现回收器视图的水平和垂直滚动。我必须显示一个包含8列的表,因此我计划同时实现水平和垂直滚动

我尝试了水平滚动视图,但它在一行中水平滚动

list_row.xml

<?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:focusable="true"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
android:orientation="vertical">

<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
  >
    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >
    <TextView
    android:id="@+id/title"
    android:textColor="@color/title"
    android:textSize="16dp"
    android:textStyle="bold"
    android:layout_alignParentTop="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
   android:text="aaa"/>

<TextView
    android:id="@+id/genre"
    android:layout_below="@id/title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:text="bbb"/>

<TextView
    android:id="@+id/year"
    android:textColor="@color/year"
    android:layout_width="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:text="ccc"/>
    </LinearLayout>
</HorizontalScrollView>
</RelativeLayout>


有没有办法在同一布局中按整个表格水平和垂直滚动列表。

您可以使用以下代码实现:

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >
    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true" >
    </HorizontalScrollView>
</ScrollView>

阅读已回答的问题,网址:


  • 您可以使用以下代码来实现:

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true" >
        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fillViewport="true" >
        </HorizontalScrollView>
    </ScrollView>
    
    
    
    阅读已回答的问题,网址:


  • 将您的
    recyclerView
    布局放到

    <android.support.v4.widget.NestedScrollView
    

    将您的
    回收视图
    布局置于

    <android.support.v4.widget.NestedScrollView
    

    您需要一个带有表布局管理器的
    回收视图。。希望这能帮助你。。。您需要一个带有Table LayoutManager的
    RecyclerView
    。请执行此操作。。希望这能帮助你。。。