So I want to animate my EditText
(ET) to expand. Plain and simple right. Well I can do it with the following code but that is from (left of ET stays in the same position, right of ET expands outwards). I would like it from the center where left and right of ET expands outwards then on any other ?Gesture or touch of anywhere? not the ET itself, it closes(shrinks) to original size in a animate way. Is there a way to do the following or a library that can help simplify this. If so leave a link all comments will be appreciated due to my entry level knowledge.
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="400"
android:fillAfter="true"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="0%"
android:pivotY="0%"
android:toXScale="2.0"
android:toYScale="1.0" >
</scale>
</set>
to start the animation from the center make
android:pivotX="50%"
android:pivotY="50%"
However with you code you are starting the animation from it's original view scale than expand it, you should animate the view from smaller scale to the original scale it should be something like that.
android:fromXScale="0.0"
android:fromYScale="1.0"
android:toXScale="1.0"
android:toYScale="1.0"
....
however, if you want to keep the old code for some reason make sure your editText
container in xml
is wide enough you don't want your editText
to interface with other views
You EditText
in xml
sholud be
android:layout_width="you_width"
android:layout_height="wrap_content"
android:minLines="1"
....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.