我有浮动文本标签/文本输入布局的布局。在向布局添加滚动视图时,浮动标签动画滞后于低端 (Moto G) 设备。没有滚动视图,动画效果很好。下面是我的布局
<ScrollView 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">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:gravity="center_horizontal"
tools:context=".activities.LoginActivity"
>
<include
android:id="@+id/branding_text"
layout="@layout/branding_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="48dp"
/>
<android.support.v7.widget.CardView
android:id="@+id/loginLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="20dp"
android:visibility="gone"
app:cardElevation="4dp"
app:cardUseCompatPadding="true"
tools:visibility="visible"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="16dp"
>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.ClinicalKey.FloatLabel"
>
<EditText
android:id="@+id/edit_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="@string/account_username_hint"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:nextFocusDown="@+id/edit_password"
android:singleLine="true"
/>
</android.support.design.widget.TextInputLayout>t>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.ClinicalKey.FloatLabel"
>
<EditText
android:id="@+id/edit_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="@string/account_password_hint"
android:imeOptions="actionDone"
android:imeActionId="@+id/action_sign_in"
android:inputType="textPassword"
android:singleLine="true"
/>
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<Button
style="?android:borderlessButtonStyle"
android:id="@+id/btRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/register"
android:textColor="@color/accent"
/>
<Button
style="?android:borderlessButtonStyle"
android:id="@+id/btLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/login"
android:textColor="@color/primary"
/>
</LinearLayout>
<Button
android:id="@+id/btForgotPassword"
style="?android:borderlessButtonStyle"
android:textColor="?attr/colorAccent"
android:text="@string/reset_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<com.lsjwzh.widget.materialloadingprogressbar.CircleProgressBar
android:id="@+id/progress_bar"
style="@style/CenterProgressBarStyle"
tools:visibility="gone"
/>
</LinearLayout>
</ScrollView>