如何实现android的垂直滑动视图UI
Posted
技术标签:
【中文标题】如何实现android的垂直滑动视图UI【英文标题】:How to achieve vertical sliding views UI for android 【发布时间】:2020-07-18 23:12:57 【问题描述】:我知道卡片视图可能在回收站视图中
更新:
这是我目前所能达到的:
回收者视图:
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:scrollbars="vertical"
android:layout_
android:layout_ />
卡片视图:
<?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_
android:layout_>
<android.support.v7.widget.CardView
android:layout_
android:layout_
app:cardCornerRadius="5dp"
app:cardElevation="4dp"
android:layout_margin="20dp"
>
<RelativeLayout
android:clipToPadding="false"
android:layout_
android:layout_>
<TextView
android:id="@+id/textview_card_label"
android:layout_
android:layout_
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 Result
问题是示例 UI 开头的展开动画背后的想法是什么? 帮助表示赞赏
【问题讨论】:
【参考方案1】:首先,您需要为自己创建 XML。这不是问题。
1- 您可以为此使用 RecyclerView Snap 助手。您必须使您的项目全屏显示,并将寻呼机快照助手设置为您的回收站视图。
PagerSnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(mRecyclerView);
2- 或者,您可以使用 View Pager 2,它支持垂直分页。
https://***.com/a/54643817/11982611详细解释
【讨论】:
我使用了RecyclerView,但是如何获取启动动画??它背后的想法是什么?以上是关于如何实现android的垂直滑动视图UI的主要内容,如果未能解决你的问题,请参考以下文章