Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.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 L'的Listview;s最近的应用程序列表视图_Android_Listview_Material Design_Android Recents - Fatal编程技术网

如何创建类似android L'的Listview;s最近的应用程序列表视图

如何创建类似android L'的Listview;s最近的应用程序列表视图,android,listview,material-design,android-recents,Android,Listview,Material Design,Android Recents,我知道如何使用RecycleView和CardView,但我想创建一个类似安卓L最新应用程序Listview的Listview 你可以从这里查到 下面是安卓5.0最新应用程序列表的屏幕截图 您可以使用carousal库,如 它允许创建垂直carausal 或者至少您可以从源代码中获得想法。正如Mohammad Khatri所说,您可以使用 并将activity_main.xml更改为 <RelativeLayout xmlns:android="http://schemas.androi

我知道如何使用RecycleView和CardView,但我想创建一个类似安卓L最新应用程序Listview的Listview

你可以从这里查到

下面是安卓5.0最新应用程序列表的屏幕截图


您可以使用carousal库,如

它允许创建垂直carausal


或者至少您可以从源代码中获得想法。

正如Mohammad Khatri所说,您可以使用

并将activity_main.xml更改为

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" 
    android:background="@android:color/darker_gray">

<!--     <com.touchmenotapps.carousel.simple.HorizontalCarouselLayout 
        android:id="@+id/carousel_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>  -->

  <com.touchmenotapps.carousel.simple.VerticalCarouselLayout 
        android:id="@+id/carousel_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/> 

</RelativeLayout>

完成之前的答案(我无法评论)

为了在垂直模式下工作,您需要两件事:

  • 在activity_main.xml中,注释HorizontalCarouselLayout并取消注释VerticalCarouselLayout
  • 在MainActivity.java中,注释处理水平旋转木马*的块,并取消注释处理垂直旋转木马的块*

但是,它的工作原理与最近的应用程序显示不完全相同,因为每次滑动都只会使您移动列表中的一个项目(没有“甩”的效果)。

在提问之前,我已经尝试过了,这是VerticalCarouselLayout的崩溃。