0

I'm trying to create a Payment Gateway, which will look a little different from the tradition Gateway looks.

Here I want a simple form in which I'll have the following EditText fields:

  1. Card Number
  2. Expiry Date
  3. CVV
  4. Name on Card

Now I want it to work the following way:

When the user hasn't typed his card number in the Card EditText field, the rest of the EditText fields won't be visible.

When the user starts typing in his card number in the Card EditText, a new pane should slide out right below the Card EditText field & it should contain the Expiry Date & CVV EditText fields.

Once the user starts tying in the CVV field, a new pane should slide out right below the CVV field & should show the EditText field for Name on Card.

How do I achieve this on Android?

Auro
  • 1,578
  • 3
  • 31
  • 62

1 Answers1

0

Set the Visibility Gone of Other in cardedittext textchange listener. Do for other too. In the Same way. Hide and Visible them on the Require text or character.

 cardedittext.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
                                  if (s.length() >= 16) {

                expiry.setVisibility(View.VISIBLE);

            } else {
                expiry.setVisibility(View.GONE);

            }

        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    });
Avinash Verma
  • 2,572
  • 1
  • 18
  • 22
  • How do I get the slide out effect? – Auro Jun 28 '16 at 13:13
  • Give me a Example ?? Use Animate translation for edit text [Read this](http://stackoverflow.com/questions/19765938/show-and-hide-a-view-with-a-slide-up-down-animation) I think this may Help You. – Avinash Verma Jun 28 '16 at 13:15