底部表格内的 RecyclerView 不起作用

2023-11-26

以下是我的xml

MainView

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Your content -->
    <include layout="@layout/content_main"/>

    <!-- Bottom Sheet -->
    <include layout="@layout/main_bottom_sheet"/>

</android.support.design.widget.CoordinatorLayout>

底表视图

<?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:id="@+id/bottom_navigation_sheet"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    android:orientation="vertical"
    app:behavior_peekHeight="56dp"
    app:layout_behavior="@string/bottom_sheet_behavior">

    <FrameLayout
        android:id="@+id/fragment_bottom_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</LinearLayout>

回收视图屏幕

<?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"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/white"
              android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/toolbar_height"
        android:background="@color/alabaster"
        android:elevation="@dimen/elevation_normal"
        android:orientation="horizontal"
        tools:targetApi="lollipop">

        <FrameLayout
            android:id="@+id/search_as_you_type_back_button"
            android:layout_width="@dimen/toolbar_height"
            android:layout_height="@dimen/toolbar_height"
            android:foreground="?selectableItemBackground">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:contentDescription="@string/accessibility_back"
                app:srcCompat="@drawable/ic_arrow_back"/>

        </FrameLayout>

        <EditText
            android:id="@+id/search_as_you_type_edit_text"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="@dimen/margin_medium"
            android:layout_weight="1"
            android:background="@color/transparent"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:gravity="center_vertical"
            android:imeOptions="actionSearch"
            android:inputType="text"
            android:textColor="@color/darkest_grey"
            android:textSize="@dimen/text_medium"
            tools:text="Chocolate"/>

        <FrameLayout
            android:id="@+id/search_as_you_type_close_container"
            android:layout_width="?attr/actionBarSize"
            android:layout_height="?attr/actionBarSize"
            android:foreground="?selectableItemBackground"
            android:visibility="invisible">

            <ImageView
                android:id="@+id/search_as_you_type_close"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:contentDescription="@string/accessibility_close"
                app:srcCompat="@drawable/ic_cancel_grey_24dp"/>

        </FrameLayout>

    </LinearLayout>

    <ViewFlipper
        android:id="@+id/view_flipper"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:inAnimation="@android:anim/fade_in"
        android:outAnimation="@android:anim/fade_out">


      <android.support.v7.widget.RecyclerView
          android:id="@+id/auto_suggest_list"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"
          android:nestedScrollingEnabled="true"/>


    </ViewFlipper>

</LinearLayout>

片段底部容器布局将使用具有 recyclerview 屏幕的片段进行膨胀。这里的 Recyclerview 在填充数据后不会滚动。当键盘弹出时它也不会被调整。我尝试设置 windowssoftInputMode。有人可以帮忙解决这个问题吗?


这是工作代码RecyclerView底页内

XML:

<layout 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">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">


            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recyclerViewMore"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:focusableInTouchMode="true"
                android:orientation="vertical"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
          
        </RelativeLayout>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

</layout>

在Java中onCreateView

B.recyclerViewMore.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        v.getParent().requestDisallowInterceptTouchEvent(true);
        v.onTouchEvent(event);
        return true;
    }
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

底部表格内的 RecyclerView 不起作用 的相关文章

随机推荐

  • 在预定的heroku dyno中访问heroku toolbelt命令?

    我想在预定的heroku任务中调用heroku postgres备份 恢复命令 但是heroku工具带在bash提示符下不可用 所以我无法调用heroku命令 heroku run bash app myapp Running bash a
  • 允许特殊字符 SQL Server 2008

    我使用的是 SQL Server 2008 Express 版本 其排序规则设置设置为默认值 我希望在数据库中存储特殊字符 如 但它会将它们转换为普通字符 如 A 如何阻止 SQL Server 这样做 确保您的列使用类型 nvarchar
  • 在 flutter 中获取设备 IMEI

    我怎样才能获得设备IMEI颤动中 我正在尝试使用以下插件获取唯一标识符 uuid type 0 7 0 dev uuid 1 0 3 unique identifier 0 0 3 flutter udid 0 0 3 他们都获得 ID 但
  • Android imageview 显示绿色图像

    这是原始图像 这是使用 ImageView 渲染的图像 然而 有时当图像在轮播中时 滑回图像可能会导致图像正确渲染 这更奇怪 在 LG G3 Android 5 1 和 Genymotion Android 4 4 4 上均观察到此行为 我
  • 在 IE9+ 上显示 base64 pdf 的解决方法

    我想将 PDF 转换为 base64 并在浏览器上显示 问题是 以下代码适用于 Firefox 和 Chrome For IE usi
  • 如何使用 Axios 从表单发布文件

    使用原始 HTML 当我使用以下命令将文件发布到 Flask 服务器时 我可以从 Flask 请求全局访问文件
  • 在 JComboBox 中显示图像

    我需要在 JComboBox 中显示图像 只需向模型添加一个图标而不是字符串 import java awt import javax swing public class ComboBoxIcon extends JFrame JComb
  • 如何在Android中使用TextWatcher类?

    谁能告诉我如何屏蔽子串 in EditText或如何改变EditText 密码类型的子字符串输入 or replace由另一个特点像这样 123xxxxxxxxx3455 String contents et1 getText toStri
  • 安全地将 JSON 字符串转换为对象

    给定一个 JSON 数据字符串 如何安全地将该字符串转换为 JavaScript 对象 显然 我可以通过以下方式不安全地做到这一点 var obj eval json 但这让我很容易受到包含其他代码的 JSON 字符串的影响 简单地评估这些
  • IDEA 的 CheckStyle 插件 - java 方式的警告呈现和自动修复?

    是否可以使其显示 java spellchecker 风格的警告列表 而不是带有行号的旧式错误列表 它可以自动修复 附近缺少空格等问题吗 也许我需要一个不同的插件 那么哪个呢 Try QAPlug 检查样式插件 然后进入 分析 分析代码 不
  • 业务验证逻辑代码异味

    考虑以下代码 partial class OurBusinessObject partial void OnOurPropertyChanged if ValidateOurProperty this OurProperty false t
  • C# 语音识别

    我现在正在制作一个智能家居控制系统 我有一个小问题 我正在考虑使用 Cosmos 作为基本系统 并向其中添加所需的命名空间库 但由于通常的 System Speech Recognition 命名空间过于依赖 Windows Speech
  • 使用 R 剪切功能 - 中断和标签选项如何工作

    我正在寻找 标签是使用 a b 间隔符号构建的 的清晰解释 如中所述cut help file 这似乎缺乏解释 所以我在一些简单的例子上测试了cut 如下 df lt data frame c 1 2 3 4 5 6 7 99 names
  • Haskell:将文件中的每一行插入列表中

    我目前正在使用 Haskell 进行项目 但发现自己遇到了一些麻烦 我应该读取 dictionary txt 文件中的每一行并将其插入到列表中 但我似乎无法这样做 我有这个代码 main do let list loadNums dicti
  • Volley onErrorResponse 给出 NullPointerException

    我在我的android应用程序中尝试volley库 这是我的日志 10 31 14 30 09 277 E AndroidRuntime 22916 java lang NullPointerException 10 31 14 30 09
  • 如何从 Qt 小部件中删除窗口边框(包含最小化、最大化和关闭按钮)?

    我想制作一个小部件 QPushButon 的动画以在我的应用程序屏幕上移动 为此 我创建了一个新按钮 并使用 QPropertyAnimation 类和按钮的属性 几何 将其从上到下移动 问题是按钮带有关闭 最小化 最大化按钮等 我不希望它
  • 在 Java Map 中查找重复值?

    我想将值显示在HashMap A HashMap可能有重复的值 但不是重复的键 但我只想显示一个值一次 所以我应该找出是否Map有重复值 我知道我们可以迭代Map并使用返回布尔值map containsValue value 我想知道是否存
  • 暂存数据库困境

    假设有3个数据库 生产 Staging Dev 据我所知 临时数据库需要与生产数据库同步 但 当我们发展的时候 我们可以为所欲为Dev数据库并更改架构 现在是先有鸡还是先有蛋的问题 要在分期中进行测试 Staging数据库模式需要根据开发数
  • 来自 CREATE USER 的语法错误,变量给出用户名和密码

    存储过程代码 CREATE DEFINER root localhost PROCEDURE P CreateUser3 IN Username NVARCHAR 30 IN Password NVARCHAR 32 IN DBName V
  • 底部表格内的 RecyclerView 不起作用

    以下是我的xml MainView