3

我知道 RecycleView 和 CardView 的使用,但我想创建可以像 android L Recent App listview 一样工作的 Listview 。

您可以从此链接查看。

下面是 android 5.0 最近应用列表的屏幕截图。

Android 5.0 最近应用列表 UI

4

3 回答 3

1

您可以使用 carousal 库,例如

http://code.google.com/p/carousel-layout-android/允许创建垂直 carausal。

或者至少你可以从源代码中得到想法。

于 2014-11-17T12:39:37.270 回答
0

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

http://code.google.com/p/carousel-layout-android/

并将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>
于 2015-02-05T16:16:07.003 回答
0

要完成以前的答案(因为我无法评论),

为了使http://code.google.com/p/carousel-layout-android/在垂直模式下工作,你需要两件事:

  • 在 activity_main.xml 中,注释 Horizo​​ntalCarouselLayout 并取消注释 VerticalCarouselLayout
  • 在 MainActivity.java 中,注释处理 Horizo​​ntalCarousel* 的块并取消注释处理 VerticalCarousel* 的块

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

于 2015-07-29T09:26:28.600 回答