简体   繁体   中英

How do I create multiple panes on Android and show them one by one?

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?

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) {

        }
    });

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM