'How to change the default UI from Braintree Card Form with Android

I'm trying to change the text color and remove this left icon :

enter image description here

So for the CardNumber I use another view to change individually

//ONLY THE CARD ENTRY
<com.braintreepayments.cardform.view.CardForm
        android:id="@+id/card_form"
        style="@style/MyCard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
//EXPIRATION,CVV,POSTALCODE
<com.braintreepayments.cardform.view.CardForm
        android:id="@+id/card_formTwo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

And tried to apply this them, but still not working..

<style name="MyCard" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:hint">EAEE</item>
</style>

CardForm



Solution 1:[1]

I haven't checked if this code works, but I guess it will give you a direction at least. This is how I suppose the icons could be removed:

CardForm cardForm = (CardForm) findViewById(R.id.card_form);
cardForm.setCardNumberIcon(0);
cardForm.setPostalCodeIcon(0);

The text color on the other hand seems not to be changeable. You can only modify the accent color according to the documentation on styling, but you may try to change the textColor too (green for accent and blue for text color in the example below):

<style name="MyCard">
    <item name="android:colorAccent">#91beae</item>
    <item name="android:textColor">#3b5998</item>
</style>

Solution 2:[2]

This works for me

Create a style :

<style name="MyCard" parent="AppTheme">
    <item name="android:colorAccent">@color/colorAccent</item>
    <item name="android:textColorHint">@color/colorGrey</item>
    <item name="android:backgroundTint">#FFFFFF</item>
    <item name="android:textColorPrimary">#FFFFFF</item>
</style>

Then don't apply it as a style, but as a theme, So add this to your Card Form:

android:theme="@style/MyCard"

I hope that works for u too.

enter image description here

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Galya
Solution 2 Zakaria Fardjallah