簡體   English   中英

android如何實現垂直滑動視圖UI

[英]How to achieve vertical sliding views UI for android

我知道這是卡片視圖,可能在回收站視圖中

在此處查看圖片

更新:

這是我到目前為止可以實現的目標:

回收者視圖:

 <android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:scrollbars="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

卡片視圖:

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.CardView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        app:cardCornerRadius="5dp"
        app:cardElevation="4dp"
        android:layout_margin="20dp"
        >
        <RelativeLayout
            android:clipToPadding="false"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            <TextView
                android:id="@+id/textview_card_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="1231231 2123123 12313 "/>
        </RelativeLayout>
    </android.support.v7.widget.CardView>

</LinearLayout>

和recyclerview代碼:

            mRecyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView);

        mLayoutManager = new LinearLayoutManager(this);
        mRecyclerView.SetLayoutManager(mLayoutManager);

        mAdapter = new CatalogAdapter(list);

        mAdapter.ItemClick += MAdapter_ItemClick;

        PagerSnapHelper snapHelper = new PagerSnapHelper();
        snapHelper.AttachToRecyclerView(mRecyclerView);

        mRecyclerView.SetAdapter(mAdapter);

這就是結果: UI 結果

問題是在示例 UI 的開頭擴展 animation 背后的想法是什么? 幫助表示贊賞

首先,您需要為自己創建 XML。 這不是問題。

1-您可以為此使用 RecyclerView Snap 助手。 您必須使您的項目全屏顯示,並將尋呼機快照助手設置為您的回收站視圖。

PagerSnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(mRecyclerView);

2- 或者,您可以使用 View Pager 2,它支持垂直分頁。

https://stackoverflow.com/a/54643817/11982611詳細解釋

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM