Tag: android textinputlayout

Android的TextInputLayout提示重叠EditText提示

我正面临一个奇怪的问题,我有一个InputTextLayout和一个EditText在里面,我试图实现这样的事情(如下图所示)(图片来自材料设计指导: https : //material.io/guidelines/components /text-fields.html#text-fields-layout ),其中有两个单独的提示。 我正在通过添加android:提示到这两个布局。 这工作正常,但是当焦点离开这个时候,“标签”向下移动并且重叠“占位符”文本。 (只有当用户没有给出任何输入和编辑文本是空的 – 两个提示重叠)。 任何指针如何解决这个问题? 作为一个要求,我需要两个提示在那里,“标签”不应该移动焦点的变化。 这两个提示应该保持在他们的位置上

如何使TextInputLayout提示为必填字段为红色星号

使用设计支持库中的TextInputLayout时,是否可以在提示红色时仅创建星号? 我已经看到关于整个提示样式的信息,但是这更复杂一点,因为只有*应该是红色的,而不是整个消息。 材料设计示例显示了这一点,但设计库似乎没有任何选择使用TextInputLayout和EditText以这种方式进行设计。 参考: https : //www.google.com/design/spec/components/text-fields.html#text-fields-required-fields 示例(带焦点的顶部有红色星号;没有焦点的底部没有红色星号): 我研究了在OnFocusChangeListener中设置提示到一个SpannableString(请参阅这里如何获取一个<string>条目中的红色星号 )(请参阅这里有textinputlayout内的编辑文本(红色星号)的必需符号 ) ,但提示是一个CharSequence。 有没有办法做到这一点,而不扩展TextInputLayout?

EditText和TextInputLayout以编程方式添加不采摘风格,不显示软键盘

我正在开发一个库模块,我希望允许客户端为EditText和TextInputLayout UI组件传递样式资源。 为了使用传递的布局,我需要在运行时对这两个组件进行充气,并将它们添加到父布局中。 当我这样做,一个奇怪的行为发生: InputTextLayout不会选择传递的样式; 点击EditText时,软键盘不会被触发。 父级布局 <android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar_wrapper" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar android:id="@+id/search_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorPrimary" android:minHeight="?attr/actionBarSize" app:layout_scrollFlags="scroll|enterAlways"> <LinearLayout android:id="@+id/toolbar_inner_container" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:gravity="center_vertical" android:orientation="horizontal" android:padding="3dip" android:weightSum="7"> <ImageView android:id="@+id/back" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:src="@drawable/ic_arrow_left_white_24dp" /> </LinearLayout> </android.support.v7.widget.Toolbar> <br.com.edsilfer.kotlin_support.presenter.layout.LineProgressBar android:layout_width="match_parent" android:layout_height="wrap_content" app:colorLine="@color/clr_theme_light_text" /> 样本预设样式: <!– THEME LIGHT –> <!– search bar input text –> <style name="TextInputThemeDark"> […]