TextInputLayout浮动标签显示缓慢 [英] TextInputLayout floating label appears slow
本文介绍了TextInputLayout浮动标签显示缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经应用了android TextInputLayout
,它可以正常工作.但是当出现Text Input Layout时,Edit文本变得非常慢.以及我已经更改了提示颜色,但是它不起作用.
I have applied android TextInputLayout
,it works fine.But when appears Text Input Layout the Edit text become very slow. as well as I have changed the hint color but its not working.
布局xml :
<android.support.design.widget.TextInputLayout
android:id="@+id/register_input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLength="15"
android:lines="1"
android:id="@+id/Register_fragment_passwo_field"
android:hint="Password"
android:layout_gravity="center_vertical"
android:paddingLeft="35dp"
android:textColor="#ffffff"
android:textColorHint="@android:color/white"
android:layout_marginTop="5dp" />
</android.support.design.widget.TextInputLayout>
依赖关系:编译'com.android.support:design:23.0.1'
推荐答案
<!-- if You Can Change Color of TextInputLayout Like this-->
<style name="TextLabel" parent="TextAppearance.AppCompat">
<!-- Hint color and label color in FALSE state -->
<item name="android:textColorHint">@color/Color Name</item>
<item name="android:textSize">20sp</item>
<!-- Label color in TRUE state and bar color FALSE and TRUE State -->
<item name="colorAccent">@color/Color Name</item>
<item name="colorControlNormal">@color/Color Name</item>
<item name="colorControlActivated">@color/Color Name</item>
</style>
如果您更改动画时间,请像这样自定义 EditText
:
If you change animation time then customize EditText
like this:
public class FloatingEditText extends FrameLayout{
animation = new AnimatorSet();
ObjectAnimator move =
ObjectAnimator.ofFloat(mHintTextView, "translationY", mHintTextView.getHeight() / 8, 0);
ObjectAnimator fade;
if (mEditText.isFocused()) {
fade = ObjectAnimator.ofFloat(mHintTextView, "alpha", 0, 1);
} else {
fade = ObjectAnimator.ofFloat(mHintTextView, "alpha", 0, 0.50f);
}
animation.playTogether(move, fade);
}
这篇关于TextInputLayout浮动标签显示缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文