android - 展开和隐藏布局 Android
问题描述
我需要将此动画 https://i.stack.imgur.com/02FtY.gif编程 到一个约束布局中,该布局有一个编辑文本和一个像图片一样的回收器视图
我没有任何想法来实现这一点。
有人可以帮我一些想法吗?
解决方案
你可以这样做CoordinatorLayout
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|enterAlways">
<androidx.appcompat.widget.SearchView
android:id="@+id/searchview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:iconifiedByDefault="false"
android:queryHint="@string/query_hint"
app:iconifiedByDefault="false"
app:queryHint="@string/query_hint" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
推荐阅读
- node.js - WebStorm Salesforce Commerce Cloud 测试错误 - 'C:\Users\...' 未被识别为内部或外部命令
- mlab - Mlab 在 ubuntu 20.04 上呈现黑屏
- javascript - 调用多个函数 onChange 事件——React
- python - deeplab tensorflow model_test.py 工作正常,但在 main 中看不到导入
- core-location - 如何在 Mac Catalyst 上测试核心位置授权提示?
- reactjs - AWS S3 存储桶策略/来自 URL 引用者的访问 - 访问被拒绝
- r - 我的 ggplot 工作时没有闪亮,但是当我使用闪亮时,它不会在没有任何错误的情况下呈现
- python-3.x - 无法识别 Docker 容器中给定目录中的 SQL 脚本
- c# - 如何使用 JsonSerializer 为日期指定默认时区?
- c++ - 使用二叉搜索树时的 C++ 堆栈溢出