-1

JAVA CODE:

 mEdtTextPickup.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if(hasFocus){
                    mLayoutDrop.invalidate();
                    mEdtTextPickup.bringToFront();
                }
            }
        });
        mEdtTextDrop.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if(hasFocus){
                    mLayoutPickup.invalidate();
                    mEdtTextDrop.bringToFront();
                }
            }
        });

` Two Edit-text with Frame-layout I have two layouts in my application Source and Destination in which one overlaps the other inside a FrameLayout.(just like the attached image)

Now how do i bring destination layout on top of source layout animated when it is focused. I googled a lot but found no solutions.

Sudhaskumar
  • 39
  • 1
  • 5

1 Answers1

0
You can use a focus change listener to identify when the field is focused and then bringToFront to bring the view above the others.

destinationEditText.setOnFocusChangeListener(new OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                edittext.bringToFront();

            } 
        }
    });
Peter Birdsall
  • 3,159
  • 5
  • 31
  • 48