简体   繁体   English

android如何实现垂直滑动视图UI

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

I know it's a card view may be in a Recycler View我知道这是卡片视图,可能在回收站视图中

在此处查看图片

Update:更新:

this is what I could achieve so far:这是我到目前为止可以实现的目标:

the recyclerview:回收者视图:

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

card view:卡片视图:

    <?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>

and the recyclerview code:和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);

and this is the result: UI Result这就是结果: UI 结果

the question is what is the idea behind the expanding animation in the begining of the example UI?问题是在示例 UI 的开头扩展 animation 背后的想法是什么? help appreciated帮助表示赞赏

First of all, you need to create XML for yourself.首先,您需要为自己创建 XML。 This is not an issue here.这不是问题。

1- You can use RecyclerView Snap helper for this. 1-您可以为此使用 RecyclerView Snap 助手。 You must make your items full screen and pager snap helper to your recycler view.您必须使您的项目全屏显示,并将寻呼机快照助手设置为您的回收站视图。

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

2- Alternatively, you can use View Pager 2, it supports vertical paging. 2- 或者,您可以使用 View Pager 2,它支持垂直分页。

https://stackoverflow.com/a/54643817/11982611 explains it in details https://stackoverflow.com/a/54643817/11982611详细解释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM