Home Stretched Animated EditText
Reply: 0

Stretched Animated EditText

user4038
1#
user4038 Published in April 26, 2018, 5:28 pm

I have a Editext that animated form both sides to expand out word. Doing so it is stretched and looks a little off (text is larger, radius of corners change to a higher value and you don't see the first 3.5 characters typed) Im wondering if there is a way around this with another animation file or another way in doing this animation. A second issue I would like to resolve but its fine for now if I can't is the mUrlSearch.ClearAnimation. I would like it smoother then a bold reset in width.

EditText_Scale.xml

<scale
android:duration="400"
android:fillAfter="true"
android:fromXScale="0.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="2.0"
android:toYScale="1.0"
</scale>

</set>

main_header.XML

<android.support.constraint.ConstraintLayout

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:id="@+id/mHeader"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@android:color/transparent">


<EditText
    android:id="@+id/mUrlSearch"
    android:layout_width="150dp"
    android:layout_height="25dp"
    android:layout_marginBottom="1dp"
    android:background="@drawable/edittext_rounded"
    android:textSize="12px"
    android:textColor="#000"

    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<Button
    android:id="@+id/m_Preferences"
    android:layout_width="wrap_content"
    android:layout_height="10dp"
    android:layout_marginBottom="21dp"
    android:layout_marginStart="17dp"
    android:background="@drawable/preference_round"
    android:textSize="12px"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toEndOf="@+id/mUrlSearch"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="1.0" />

</android.support.constraint.ConstraintLayout>

activity_main.XML

<android.support.constraint.ConstraintLayout
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:id="@+id/mainPage"
android:layout_width="match_parent"
android:layout_height="match_parent"

tools:context="com.equiware.mickeyt.unite.MainActivity">

<WebView
    android:id="@+id/mWebView"
    android:layout_width="362dp"
    android:layout_height="570dp"

    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="1.0">


</WebView>

<include
    android:id="@+id/mHeader"
    layout="@layout/main_header"
    android:layout_width="360dp"
    android:layout_height="35dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.0">


</include>

</android.support.constraint.ConstraintLayout>

Section from Main .java

    mUrlSearch.setOnFocusChangeListener(new OnFocusChangeListener(){

        public void onFocusChange(View v,boolean hasFocus){
            if (mUrlSearch.isFocused()) {
                Animation anim = AnimationUtils.loadAnimation(MainActivity.this, R.anim.edittext_scale);
                mUrlSearch.startAnimation(anim);
            }
            else
            {
            mUrlSearch.clearAnimation();
            }
        }
    });
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.35221 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO