首页 \ 问答 \ AppCompat Spinner的TextInputLayout错误对齐问题(TextInputLayout error alignment issue with AppCompat Spinner)

AppCompat Spinner的TextInputLayout错误对齐问题(TextInputLayout error alignment issue with AppCompat Spinner)

我正在使用一个应用程序,它显示一个下拉Spinner其中一个EditText作为TextInputLayout的子项。

TextInputLayout下显示带下划线的错误时, EditText将会上升,并且对齐将会错过!

请看我的截图:

在此处输入图像描述

我想做的是:

在此处输入图像描述

这是我的xml代码:

<LinearLayout
    android:layout_width="@dimen/edittext_width"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:gravity="bottom">

    <android.support.v7.widget.AppCompatSpinner
        android:id="@+id/spinner_countries"
        style="@style/Widget.AppCompat.Spinner.Underlined"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="30"
        android:layout_gravity="start"
        android:spinnerMode="dialog" />

    <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_mobile"
        style="@style/TextInputLayoutTheme"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="70">

        <com.cashu.app.ui.widgets.CustomEditText
            android:id="@+id/et_fragment_register_step_one_mobile"
            android:layout_width="@dimen/edittext_mobile_num_width"
            android:layout_height="wrap_content"
            android:ems="12"
            android:gravity="center_vertical"
            android:layout_gravity="start"
            android:hint="@string/mobile_hint"
            android:inputType="number"
            android:textSize="@dimen/font_size_normal" />
    </android.support.design.widget.TextInputLayout>

</LinearLayout>

这是我的TextInputLayout主题:

<!-- TextInputLayout Style -->
<style name="TextInputLayoutTheme" parent="Widget.Design.TextInputLayout">
    <item name="android:gravity">center</item>
    <item name="android:textColor">@color/white</item>
    <item name="android:textColorHint">@color/colorControlActivated</item>
    <item name="errorTextAppearance">@style/AppTheme.TextErrorAppearance</item>
    <item name="counterTextAppearance">@style/TextAppearance.Design.Counter</item>
    <item name="counterOverflowTextAppearance">@style/TextAppearance.Design.Counter.Overflow</item>
</style>

我尝试搜索许多关键字,术语和方法,但遗憾的是没有运气。

如果有人对此问题有任何攻击,我将不胜感激。


I am using an app which displays a drop down Spinner with an EditText as a child of TextInputLayout next to it.

When an underlined error is shown under the TextInputLayout, then the EditText will go up, and alignment will miss !!

See my screenshot please:

enter image description here

What I am trying to do is:

enter image description here

Here is my xml code:

<LinearLayout
    android:layout_width="@dimen/edittext_width"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:gravity="bottom">

    <android.support.v7.widget.AppCompatSpinner
        android:id="@+id/spinner_countries"
        style="@style/Widget.AppCompat.Spinner.Underlined"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="30"
        android:layout_gravity="start"
        android:spinnerMode="dialog" />

    <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_mobile"
        style="@style/TextInputLayoutTheme"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="70">

        <com.cashu.app.ui.widgets.CustomEditText
            android:id="@+id/et_fragment_register_step_one_mobile"
            android:layout_width="@dimen/edittext_mobile_num_width"
            android:layout_height="wrap_content"
            android:ems="12"
            android:gravity="center_vertical"
            android:layout_gravity="start"
            android:hint="@string/mobile_hint"
            android:inputType="number"
            android:textSize="@dimen/font_size_normal" />
    </android.support.design.widget.TextInputLayout>

</LinearLayout>

Here is my TextInputLayout theme:

<!-- TextInputLayout Style -->
<style name="TextInputLayoutTheme" parent="Widget.Design.TextInputLayout">
    <item name="android:gravity">center</item>
    <item name="android:textColor">@color/white</item>
    <item name="android:textColorHint">@color/colorControlActivated</item>
    <item name="errorTextAppearance">@style/AppTheme.TextErrorAppearance</item>
    <item name="counterTextAppearance">@style/TextAppearance.Design.Counter</item>
    <item name="counterOverflowTextAppearance">@style/TextAppearance.Design.Counter.Overflow</item>
</style>

I tried searching for many keywords, terms and methods but unfortunately with no luck.

I would appreciate if anyone has a hack for this issue.


原文:https://stackoverflow.com/questions/39764346
更新时间:2022-04-09 16:04

最满意答案

放置唯一约束的原因是为了确保两个面没有相同的鼻子。 由于这是1:1的关系,鼻子的Id保持在脸上。 这就是为什么。


The reason for putting the unique constraint is to ensure that two faces don't have the same nose. Since this is a 1:1 relationship the Id of the nose is kept on the face. That's why.

相关问答

更多
  • 解决方法(如您提到的github错误中所述)是使用Cypher。 使用Batch和Cypher的示例: [ {"method":"POST","to":"/index/node/concept?uniqueness=get_or_create","id":0,"body":{"key":"nom", "value":"organisation", "properties": {"nom":"organisation"}}}, {"method":"POST","to":"/index/nod ...
  • 我认为这在任何地方都没有记录。 这听起来像是发生了什么: 您创建一个新实例。 您的约束意味着此实例与现有实例匹配。 但... 您的新实例对此关系的值为零。 所以... 关系的现有实例的值将替换为此新的nil值。 要维护关系,您的新实例需要已具有该关系的正确值。 您基本上要求约束匹配系统忽略新实例中关系值不同但接受其他属性的新值这一事实。 我认为你所期待的是完全合理的,但我对目前的实施不支持它并不感到惊讶。 我建议向Apple提交有关此问题的错误,并调查基于非约束的方法以保持数据的唯一性。 I don't t ...
  • “良好实践”是允许我们使偏见听起来比实际更重要的那些短语之一...... 一般来说,你想把所有属于一起的东西放在一起。 如果你有一个单一的信息系统,它为企业运行一切,而你管理的实体彼此相关 - 客户有订单,订单有销售人员和产品 - 你可以争辩说他们属于一个整体。 另一方面,如果你注意到你有表的“孤岛”并不真正链接到任何其他表,可能它们不属于一起。 从可维护性的角度来看,管理更多的数据库意味着更多的备份,更多的维护例程和更多的安全配置文件来管理。 从可读性的角度来看,围绕不同的数据库寻找您感兴趣的表可能是一件 ...
  • 我认为任何形式的强制类型,如果在运行时不可能知道的类型(如任何动态语言)出乎意料的话,都是不好的做法。 例如,这些都是真实的: "0" == false "0" 虽然这是错误的: false I would argue that any form of type coercion, if unexpected for types that may not be known at runtime (like any dynamic language) is bad practice. For exa ...
  • 我将介绍从人到地址的关联。 给定的人不能有多个地址,因为其关联的表具有该地址的外键列。 因此,它可以是OneToOne或ManyToOne。 由你来决定它是哪一个,而选择不依赖于任何技术。 如果您不希望两个不同的人共享同一个地址,那么它就是OneToOne。 如果你决定两个人可以共享同一个地址,那么它就是ManyToOne。 如果它是OneToOne,你应该确保它确实是OneToOne,并且两个人不能共享相同的地址。 最有效和最简单的方法是添加person表的address_id列的唯一约束。 但是Hibe ...
  • 考虑到它如何影响范围链,我会称之为不好的做法。 看看道格拉斯·克罗克福德的这篇文章:“ 声明被认为是有害的 ” I would call it bad practice, considering how it affects the scope chain. Take a look at this article from Douglas Crockford: "with Statement Considered Harmful"
  • 你总是Assert.assertTrue(true)因为assertTrue是为不同目的而设计的。 它在那里检查涉及多个布尔项的一般条件,例如 Assert.assertTrue(t == null ||| minSize < 0 || t.size() > minSize); 声明一个常量true总是会成功,因此你可以从代码中完全删除这一行。 通过放置Assert.fail();完成预期的异常不被抛出的情况Assert.fail(); 紧跟在必须抛出异常的测试代码行之后,并带有一条消息,指示未抛出期望的 ...
  • 在这种特殊情况下,您应该能够使用merge替换create 。 match (a)-[r]->(b)<-[r2]-(c) merge (a)-[new:CoAuthor]->(c) on create set new.weight=1 on match set new.weight=new.weight+1 You should be able to replace create with merge in this particular case. match (a)-[r]->(b)<-[r2]-(c ...
  • 放置唯一约束的原因是为了确保两个面没有相同的鼻子。 由于这是1:1的关系,鼻子的Id保持在脸上。 这就是为什么。 The reason for putting the unique constraint is to ensure that two faces don't have the same nose. Since this is a 1:1 relationship the Id of the nose is kept on the face. That's why.
  • 那么,只要以正确的方式存储数据,存储数据的方式就不那么重要了。 如果使用SQL Server并不重要(顺便说一句,如果您的数据小于2GB,则可以使用varbinary(max),限制为2GB并将数据存储在该列中)。 重要的是以下事项: 您选择了正确的加密算法 - 您可以选择对称加密和非对称加密算法。 您保存并保护加密密钥。 如果有人可以轻松获得密钥,那么加密没有多大价值。 在加密流之后 - 如果将它存储在NoSQL DB,SQL Server或文件系统上的文件中并不重要 - 选择最适合您应用的内容。 如果您 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)