TextInputLayout 中的 EditText 滞后

2024-01-02

我有两种观点使用TextInputLayout。第一个是只有 2 个输入字段的登录视图,第二个是有许多输入字段的注册视图。我在用TextInputLayout and EditText/AppCompatEditText为我的输入提供自定义主题。
问题是,当我点击我的EditText在我的注册屏幕中,我在默认情况下出现了某种滞后/尖峰TextInputLayout动画片。我没有感觉到延迟LoginScreen但我使用的代码完全相同,所以我认为问题在于输入的数量。有什么想法或想法吗?
这是我的注册码:

<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:orientation="vertical"
tools:context=".activities.MainActivity">

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    app:title="Register as shipper"
    app:titleTextColor="@color/white" />

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="@dimen/space">

        <View
            android:layout_width="0px"
            android:layout_height="0px"
            android:focusable="true"
            android:focusableInTouchMode="true" />

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@color/hintTextOnLightBackgrounds"
            app:hintTextAppearance="@style/TextLabel">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/fullNameEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:hint="@string/shipper_register_full_name"
                android:inputType="text"
                android:nextFocusLeft="@id/fullNameEdit"
                android:nextFocusUp="@id/fullNameEdit"
                android:theme="@style/EditText" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@color/hintTextOnLightBackgrounds"
            app:hintTextAppearance="@style/TextLabel">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/companyNameEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:hint="@string/shipper_register_company_name"
                android:theme="@style/EditText" />

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

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@color/hintTextOnLightBackgrounds"
            app:hintTextAppearance="@style/TextLabel">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/phoneNumberEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:hint="@string/shipper_register_phone_number"
                android:theme="@style/EditText"
                android:inputType="phone" />

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

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@color/hintTextOnLightBackgrounds"
            app:hintTextAppearance="@style/TextLabel">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/emailEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:hint="@string/shipper_register_email"
                android:theme="@style/EditText"
                android:inputType="textEmailAddress" />

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

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@color/hintTextOnLightBackgrounds"
            app:hintTextAppearance="@style/TextLabel">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/passwordEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:hint="@string/shipper_register_password"
                android:theme="@style/EditText"
                android:inputType="textPassword" />

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

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@color/hintTextOnLightBackgrounds"
            app:hintTextAppearance="@style/TextLabel">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/addressEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:hint="@string/shipper_register_address"
                android:theme="@style/EditText"
                android:inputType="text" />

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

        <android.support.v7.widget.AppCompatSpinner
            android:id="@+id/typeSpinner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp" />

        <Button
            android:id="@+id/registerBtn"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_marginBottom="5dp"
            android:layout_marginTop="@dimen/space"
            android:text="@string/shipper_register_register"
            android:theme="@style/ButtonPrimary" />

    </LinearLayout>
</ScrollView>

和登录:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="@dimen/space">

<ImageView
    android:layout_width="wrap_content"
    android:layout_marginLeft="50dp"
    android:layout_marginRight="50dp"
    android:src="@drawable/logo_color"
    android:layout_height="wrap_content" />

<View
    android:layout_width="0px"
    android:layout_height="0px"
    android:focusable="true"
    android:focusableInTouchMode="true" />

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textColorHint="@color/hintTextOnLightBackgrounds"
    app:hintTextAppearance="@style/TextLabel">

    <android.support.v7.widget.AppCompatEditText
        android:id="@+id/emailEdit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/login_email"
        android:inputType="textEmailAddress"
        android:theme="@style/EditText" />
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textColorHint="@color/hintTextOnLightBackgrounds"
    app:hintTextAppearance="@style/TextLabel">

    <android.support.v7.widget.AppCompatEditText
        android:id="@+id/passwordEdit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:hint="@string/login_password"
        android:inputType="textPassword"
        android:theme="@style/EditText" />
</android.support.design.widget.TextInputLayout>

<Button
    android:id="@+id/loginBtn"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/login_login"
    android:theme="@style/ButtonPrimary" />

<Button
    android:id="@+id/shipperRegisterBtn"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/login_register_as_shipper"
    android:theme="@style/ButtonPrimary" />

<Button
    android:id="@+id/carrierRegisterBtn"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/login_register_as_carrier"
    android:theme="@style/ButtonPrimary" />

我认为延迟的原因是 TextInputLayout 的提示动画和对 Activity 主窗口所做的调整同时发生(因为显示软键盘)。

就我而言,使用android:windowSoftInputMode="adjustNothing"在 Manifest 中的活动标记内完成这项工作,因为它使键盘出现在内容上,而无需对活动的主窗口进行任何调整,但是由您决定键盘是否可以覆盖您的 TextInputLayout。

作为最后一个选项,我们可以设置app:hintAnimationEnabled="false"到 TextInputLayout。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

TextInputLayout 中的 EditText 滞后 的相关文章

  • 如何使用 gradle 从 3 个子模块构建 1 个 jar

    I have 安卓工作室3 gradle 4 1 梯度工具3 classpath com android tools build gradle 3 0 1 当我有一个模块并使用 gradle 工具 2 时 我使用了 task makeJar
  • 在 ChromeO 上安装未知来源的 apk

    我今天早上更新了我的 Chromebook Asus Flip 以获取 Play 商店 我的 Chromebook 安装了 M53dev 通道版本 它运作良好 我可以安装并运行从 Play 商店下载的 Android 应用程序 我想测试我的
  • 吉夫伦致命信号11

    我正在尝试使用一些本机代码来创建 Gif 我使用绘画绘制图像 创建一些笔画 单击 保存 绘制的图像将保存为 JPG 格式 当我单击 创建 Gif 时 它会获取所有图像并开始创建 gif 这是当我收到致命信号 11 并且应用程序重新启动时 我
  • 为什么反射会减慢Android手机的速度

    我多次读到反射会降低手机性能 这有多真实 例如 在我的例子中 我从 Web 服务获取一些参数 这些参数与我在 Android 应用程序中的类的参数同名 所以我只是使用java字段和反射设置这些参数的值 它似乎并没有降低性能 有人可以向我解释
  • Android 全屏对话框确认和拒绝操作

    材料设计中的全屏对话框应该在操作栏 工具栏上有确认和拒绝操作 我的问题是 我该怎么做 显示对话框 getFragmentManager beginTransaction add R id container new MyDialogFrag
  • 如果使用grifika的ContinualCaptureActivity中的预览方式,相机预览的视野会更小

    我们知道 当相机预览比例设置为时 在相同距离下我们会得到更大的预览视野4 3代替16 9 具体如下 Android Camera API 奇怪的缩放效果 https stackoverflow com questions 20664628
  • 华为手机“受保护的应用程序”设置及处理方法

    我有一台搭载 Android 5 0 的华为 P8 用于测试应用程序 该应用程序需要在后台运行 因为它跟踪 BLE 区域 我发现华为内置了一个名为 受保护的应用程序 的 功能 可以从手机设置 电池管理器 gt 受保护的应用程序 访问该功能
  • HMS 核心地图套件在我的 Android 应用程序上根本无法工作

    我正在尝试在我的应用程序中使用华为 HMS 地图套件 我对整体地图很陌生 无论是来自谷歌还是华为 我按照文档中的教程以及华为提供的代码实验室中的说明进行操作 并将我的代码在一起 但是当我运行地图活动时 什么也没有出现 我得到的只是一个空白活
  • Android上如何获取ImageView的Drawable的矩形?

    我想要获取将包裹 ImageView 的 Drawable 的矩形对象 而不是包裹 ImageView 的矩形 我将使用该矩形在 Drawable 周围绘制一些奇特的矩形 我怎样才能得到那个矩形 Rect rect new Rect Ima
  • React Native Expo StackNavigator 重叠通知栏

    我正在尝试为我的 React Native Expo 应用程序实现导航栏 这里有一个问题 dependencies expo 18 0 3 react 16 0 0 alpha 12 react native 0 45 1 react na
  • Android 中 localTime 和 localDate 的替代类有哪些? [复制]

    这个问题在这里已经有答案了 我想使用从 android API 获得的长值 该值将日期返回为长值 表示为自纪元以来的毫秒数 我需要使用像 isBefore plusDays isAfter 这样的方法 Cursor managedCurso
  • Android -room 持久库 - DAO 调用是异步的,因此如何获取回调?

    从我读到的Room 不允许您在主线程上发出数据库查询 因为可能会导致主线程延迟 所以想象一下我正在尝试更新 UI 主线程上的文本视图 其中一些数据我将如何得到回调 让我给你举个例子 想象一下 我想将我的业务模型数据存储到一个名为 事件 的对
  • Android蓝牙java.io.IOException:bt套接字已关闭,读取返回:-1

    我正在尝试编写一个代码 仅连接到运行 Android 5 0 KitKat 的设备上的 目前 唯一配对的设备 无论我尝试了多少方法 我仍然会收到此错误 这是我尝试过的最后一个代码 它似乎完成了我看到人们报告为成功的所有事情 有人能指出我做错
  • 如何使用 SharedPreferences 保存多个值?

    我正在开发一个字典应用程序 在我的应用程序中 我假设用户想要保存最喜欢的单词 我决定使用共享首选项保存这些值 我知道 SQLite 和文件更好 但我坚持使用 SharedPreferences 所以继续使用它 下面是我的代码 Overrid
  • 如何将 Android 添加到 Phonegap 平台版本 3

    经过大量挖掘 我相信这个问题 https stackoverflow com questions 18423444 phonegap 3 doesnt work with andriod studio与我没有添加任何用于构建phonegap
  • Android模拟器中的网络访问

    我试图通过我的 Android 应用程序访问互联网 但我既成功又失败 我在构建应用程序时启动模拟器 并且应用程序安装得很好 我可以使用浏览器访问互联网 但是 当我尝试这个小代码片段时 InetAddress inet try inet In
  • 当目标小于 Android O 时,如何在 Android O 上创建快捷方式?

    背景 Android O 对快捷方式的工作方式进行了各种更改 https developer android com preview behavior changes html as https developer android com
  • 为什么python+sqlite3特别慢?

    我尝试使用 Python 2 7 4 sqlite3 和 Firefox SQLite Manager 0 8 0 处理对同一数据库的相同请求 在小型数据库 8000 条记录 上 Python 和 Firefox 都运行得很快并且给出了相同
  • 如何访问我的 Android 程序中的联系人

    我正在制作一个短信应用程序 并且想要访问我的 Android 应用程序中的联系人 我想访问联系人 就像他们在实际联系人列表中一样 选择后 我需要返回到我的活动 在其中我可以向该人发送短信 或者是否可以访问存储联系人的数据库 我的代码如下所示
  • Android GetPTLAFormat 上的 Phonegap 错误

    我们正在开发一个使用 jQuery 移动和电话间隙的应用程序 一切似乎都工作正常 但是当在连接的 Android 手机上运行应用程序时 我们在 Eclipse logcat 中看到大量类似这样的错误 0 GetPTLAFormat inva

随机推荐

  • 添加锚点到 RedirectToAction 结果?

    我正在尝试创建一个类似于的扩展方法MVCContrib 的 RedirectToAction 方法 http mvccontrib codeplex com SourceControl changeset view c0a43d6843a7
  • iOS Foundation:系统字体大小

    我想知道iOS应用程序tableView中的systemFontSize是否是always文本标签也一样吗 这是取决于风格 例如当我NSLog f UIFont systemFontSize 我已经14 0了这总是一样的吗 更重要的是 如何
  • 创建具有多个选项的 Python 函数的最佳方法?

    我定义了一堆自定义函数 并发现其中很多包含一些相同或相似的代码块 例如 仅包含略有不同的字符串或参数 所以像这样 def func1 a b c some identical code some similar code more iden
  • 有没有办法将 Linux 管道设置为非缓冲或行缓冲?

    我的程序正在控制 Linux 上的外部应用程序 通过管道将输入命令传递到外部应用程序 stdin 并通过管道从外部应用程序 stdout 读取输出结果 问题在于 对管道的写入是按块缓冲的 而不是按行缓冲的 因此在我的应用程序接收外部应用程序
  • 如何在 Bigquery 中查询多个 Firebase 项目?

    如何放置 Select 查询以从多个 Firebase 项目中提取数据 如何在单个查询中查询 abc 项目和 xyz 项目 目前 我正在放置两个查询来从项目 abc 和 xyz 及其数据集表中提取数据 查询abc项目 SELECT app
  • 如何使用低级 8 位标志作为条件?

    在我的键盘钩子中 每次按键都会有一个标志 表明它是否被注入 http msdn microsoft com en us library ms644967 VS 85 aspx http msdn microsoft com en us li
  • 2d std::vector 连续内存?

    考虑下面的代码 它分配了一个 2dstd vector
  • chmod 757 安全吗?

    由于我在共享主机上 我想添加一个图像托管脚本 似乎755不允许我上传图像 所以我将文件夹更改为757 chmod到757安全吗 一句话 不 用两个字来说 见鬼 不 让我们解释一下757 那就是 所有者 读写执行 对文件具有权限的组 读取 执
  • 在 MS Access 中插入具有日期范围的多条记录

    希望有人可以帮忙吗 我对 Access 2016 还很陌生 我的任务是为我们学校的早餐和课后俱乐部构建一个非常简单的预订系统 我有一个包含儿童列表的表 主键是 ChildID 另一个表 CLUBS 列出了 5 个可用的俱乐部 第三个表 BO
  • 使用 Castle.Windsor 设置 FluentValidation 时出现问题

    我有一个 asp net MVC 4 5 应用程序 使用 Castle Windsor 3 2 2 作为 DI 我第一次尝试添加 FluentValidation 版本 5 0 0 1 我创建了继承自 ValidatorFactoryBas
  • 为什么使用引用限定符 & 声明删除的赋值运算符

    据我所知 用户声明的赋值运算符与内置运算符不同 如所解释的这个 stackoverflow 答案 https stackoverflow com a 16995559 3054219 但是为什么要在已删除的运算符中添加 呢 C class
  • 如何在跑步时更改 Google 地图的语言?

    我不想反转地理编码并获取两种语言 阿拉伯语和英语 的地址 因此我想获取一种语言的地址 然后更改 API 的语言并获取另一种语言的地址 因为我找不到参数发送到地理编码器以确定语言 有什么建议么 加载 API 时可以通过附加来选择语言langu
  • c# 删除多余空格的最快方法

    将多余的空格替换为一个空格的最快方法是什么 e g from foo bar to foo bar 最快的方法 迭代字符串并在 a 中构建第二个副本StringBuilder一个字符一个字符 每组空格只复制一个空格 越容易打字Replace
  • 在 WebView 中使用 Stripe Mobile Checkout / 在 Kik 中使用 Payments

    我正在尝试实施 Stripe Checkout 以在 Kik 浏览器中接受移动支付 但不幸的是 在尝试加载 Checkout 时出现以下错误 抱歉 加载 Checkout 时出现问题 如果这种情况仍然存在 请尝试使用其他浏览器 尝试创建自定
  • Google 幻灯片:找不到新插入的表格

    我想知道发生了什么事 我有两个函数 当一一调用时 它们都运行良好 function createTable var slidesPage SlidesApp openById 1QWRV4eQzGNNBz4SkR3WPurTL3O60oGY
  • 如何构建优雅降级的 HTML5 Range?

    我想使用
  • 什么是“libgnarl”?

    What is libgnarl 我在不同的地方找到了对此的引用 例如在 gcc 源代码中或 gprbuild 的详细输出中 gprbuild 特别报告了有关决定是否libgnarl甚至是必要的 所以它显然是一个可选库 但实际的库是什么 我
  • 有哪些方法可以加快seabornspairplot的速度

    我有一个包含 250 000 行但 140 列的数据框 我正在尝试构建一个对图 的变量 我知道子图的数量很大 而且绘制图所需的时间也很多 我在 3 4 GHZ 和 32 GB RAM 的 i5 上等待了一个多小时 记得 scikit lea
  • FB 未定义

    如果按下 Facebook Like 按钮 我尝试重定向到 URL 但它不起作用 并且结果在源视图中出现错误 提示 FB 未定义 这是我的重定向代码 FB Event subscribe edge create function respo
  • TextInputLayout 中的 EditText 滞后

    我有两种观点使用TextInputLayout 第一个是只有 2 个输入字段的登录视图 第二个是有许多输入字段的注册视图 我在用TextInputLayout and EditText AppCompatEditText为我的输入提供自定义