简体   繁体   中英

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:

            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

the question is what is the idea behind the expanding animation in the begining of the example UI? help appreciated

First of all, you need to create XML for yourself. This is not an issue here.

1- You can use RecyclerView Snap helper for this. 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.

https://stackoverflow.com/a/54643817/11982611 explains it in details

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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