android - 如何实现android的垂直滑动视图UI
问题描述
我知道这是卡片视图,可能在回收站视图中
更新:
这是我到目前为止可以实现的目标:
回收者视图:
<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 开头的扩展动画背后的想法是什么?帮助表示赞赏
解决方案
首先,您需要为自己创建 XML。这不是问题。
1-您可以为此使用 RecyclerView Snap 助手。您必须使您的项目全屏显示,并将寻呼机快照助手设置为您的回收站视图。
PagerSnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(mRecyclerView);
2- 或者,您可以使用 View Pager 2,它支持垂直分页。
推荐阅读
- java - 包含 ? 用 thymeleaf 自动更改为 %3F
- coldfusion - 试图从 cfc 函数中获取这样的数据
- c# - 如何将两个不同的功能分配给同一个按钮?
- javascript - 对 Bootstrap Table 生成的下拉标签进行排序,以保持打开状态
- javascript - 在溢出的 React-Select 多选输入中滚动到底部
- c++ - 我用 C++ 创建的窗口不显示
- excel - 合并具有相同值VBA的单元格
- jquery - '如何修复'JQuery Dropdown inside dropdown''
- django - '将 html 表单数据保存在数据库中' django
- google-colaboratory - 如何使用 Colaboratory 进行持久安装?