braintree / android-card-form

A ready-made card form layout that can be included in your Android app, making it easy to accept credit and debit cards.
MIT License
366 stars 130 forks source link

Layout order #75

Closed LipeDuoli closed 5 years ago

LipeDuoli commented 5 years ago

General information

Issue description

There is a way to change fields order? I want to add Name at last position card_form_OutlinedBox

scannillo commented 5 years ago

Hello @LipeDuoli . Currently, the way to achieve re-ordering the fields would be for you to fork the repo and manually re-arrange them yourself.

Feel free to give us more information on your use case so we can determine if this is something we should consider implementing! Thanks.

quinnjn commented 5 years ago

@LipeDuoli you can redefine the layout xml file in your res folder and change the order how you wish.

I don't think the CardForm has any logic expecting a specific order so you should be OK. If you do run into trouble though feel free to comment here and we'll see if we can address it.

quinnjn commented 5 years ago

Here is an example of reordering the fields: https://github.com/quinnjn/android-card-form-issue-75

This is how it is done: https://github.com/quinnjn/android-card-form-issue-75/commit/cc1d80bbfd30630cd4d3b6dbbedbc93317da737a

LipeDuoli commented 5 years ago

@scannillo the problem I'm having in my app is because users are starting typing the card number on first field without seeing anything else, and searching on several other apps that has card register, the first field is almost always the card number. So rearranging the fields, I can provide the best usability for my users.

@quinnjn thx for this tip, but reordering with this way has a little usability issue because the setOnCardFormSubmitListener still called after CVV field and not the name, that now is the last field on form. I think i can add some workaround on code but is not the best way to do..