Custom Credit Card Design in Android- Coding Shiksha

Custom Credit Card Design in Android- Coding Shiksha

 

Welcome Folks I am back with another blog post.In this post we will be learning about a library which is CustomCreditCard which is a Credit Card Library for Android Applications.It is very useful when you want to integrate Payment Gateways such as Stripe and Visa Cards in your android application. In this post we will be seeing examples of this library. Let’s get started.

READ  How to Increase the Speed of Gradle in Android Studio

 

Setup

 

In dependencies

 

dependencies {
   
    implementation : 'com.example.creditcardlibrary:cardview:0.0.15'
   
}

 

Use the Library

 

XML Code

 

<com.example.creditcardlibrary.view.CustomCreditCard
            android:id="@+id/card"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:cardType="VISA"
            app:month="JUNE"
            app:year="2041"
            app:scrBackground="@drawable/cbimage"/>

 

READ  Firebase Phone Authentication in Android - Full Tutorial

Or add this view programmatically.

CustomCreditCard(this)

 

card.addWatchers(number = cardNumber, cvv = cvv)
card.setYear(2021)
card.setCreditNumber("1234 1234 1234 3457")
card.setMonth(MONTH.JANUARY)
card.setSrc(R.drawable.visa_gradient)

or like this
card.setCreditNumber("2121")
            .setYear(2039)
            .setType(TYPE.VISA)
            .setSrc(R.drawable.cbimage)
            .setMonth(MONTH.JUNE)
            
or like this
card.apply { 
            setYear(2039)
            setMonth(MONTH.JANUARY)
            setCreditNumber("1234 1234 1234 1234")
        }

 

card.addWatchers(number = cardNumber, cvv = cvv)
or 
card.addWatchers(number = cardNumber)
or
card.addWatchers(cvv = cvv)

 

READ  Android Easy Runtime Permissions with Dexter

 

 

Leave a Reply

Close Menu