I use TextInputLayout and in which I set drawableLeft, and when I click on edittext, the label already pops up, but I want to put the left selected label. How can I achieve, see the attached image ...
Right now, when I click on “Title”, only babble pops up, but I want both to be floating “leftdrawable” and “label” when focusing. And before you click, it will look normal, like "Date of Service."

My code is below ..
<FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/input_layout_cardnum" > <ImageView android:id="@+id/imgLeft" android:layout_width="30dp" android:layout_height="30dp" android:layout_gravity="bottom" android:src="@mipmap/ic_launcher" android:layout_marginBottom="10dp" /> <android.support.design.widget.TextInputLayout android:id="@+id/input_layout_cardnums" android:layout_width="match_parent" android:layout_height="wrap_content" > <EditText android:id="@+id/cardnumEditTexst" android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLength="255" android:singleLine="true" android:hint="hello" android:drawableLeft="@null" android:paddingLeft="35dp" /> </android.support.design.widget.TextInputLayout> </FrameLayout>
And in my code, I set the onFocus animation, so it goes on top with a label
final Animation animation = AnimationUtils.loadAnimation(this,R.anim.anims); final ImageView imgLeft = (ImageView) findViewById(R.id.imgLeft); final EditText et = (EditText) findViewById(R.id.cardnumEditTexst); et.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { if (et.getText().length() == 0) { imgLeft.startAnimation(animation); } } else { if (et.getText().length() == 0) imgLeft.clearAnimation(); } } });
And my animation will throw an image at the top
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" android:duration="200" android:interpolator="@android:interpolator/linear" > <scale android:fromXScale="0%" android:fromYScale="0%" android:toXScale="60%" android:toYScale="60%" android:pivotX="50%" android:pivotY="50%" /> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:startOffset="100" android:fromYDelta="0%" android:toYDelta="-80%"/> </set>
And having set this, I am now swimming, but watching paddingLeft = "35dp" , I want to start it from the 0th position, as shown in the first image where the "Title" is displayed, I mean that there should be no additions, but if I delete , paddingLeft will lose floating functionality.
