【问题标题】:How to create Listview like android L's recent App listview如何创建像android L最近的App listview一样的Listview
【发布时间】:2014-11-17 12:11:25
【问题描述】:

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

你可以从这个link查看。

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

【问题讨论】:

    标签: android listview material-design android-recents


    【解决方案1】:

    您可以使用轮播库,例如

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

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

    【讨论】:

    • 我在提问之前已经尝试过了,但 VerticalCarouselLayout 崩溃了。
    【解决方案2】:

    正如 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>
    

    【讨论】:

      【解决方案3】:

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

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

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

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

      【讨论】:

        猜你喜欢
        • 2013-07-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-06-09
        • 2021-07-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多