
我使用TextinputLayout从用户那里获取密码,如下所示:
<androID.support.design.Widget.TextinputLayout androID:ID="@+ID/RegisterPassinput" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_marginleft="16dp" app:passwordToggleEnabled="true" androID:layout_marginRight="16dp" androID:layout_toStartOf="@+ID/RegisterPassimg"> <EditText androID:ID="@+ID/RegisterPassET" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:gravity="right" androID:hint="@string/Password" androID:inputType="textPassword" androID:maxLength="40" /> </androID.support.design.Widget.TextinputLayout>结果是:
但我想要这样的东西:
如何在editText左侧设置passwordToggle gravity align.
出于很多原因,我在清单中禁用了rtl支持
androID:supportsRtl="false"解决方法:
在TextinputLayout中,添加以下参数:
androID:layoutDirection="rtl"编辑:
对于API< 17(使用androID.support.v4.vIEw.VIEwCompat):
TextinputLayout inputLayout = (TextinputLayout) findVIEwByID(R.ID.RegisterPassinput); VIEwCompat.setLayoutDirection(inputLayout, VIEwCompat.LAYOUT_DIRECTION_RTL); 总结 以上是内存溢出为你收集整理的android – 向左更改PasswordToggle Gravity(对于RTL语言)全部内容,希望文章能够帮你解决android – 向左更改PasswordToggle Gravity(对于RTL语言)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)