Wednesday, April 22, 2015

Android UI: CardView

I may be late to the game, but as I'm delving into the depths of Android UI design, the card views are a fantastic compatibility library to make apps look more professional. And it's simple, too.

To use the Card UI, simply add the following into the dependencies of the build.gradle file of the app.

    compile 'com.android.support:cardview-v7:21.0.+'
    compile 'com.android.support:recyclerview-v7:21.0.+'

Then to use this in the layout xml:

<android.support.v7.widget.CardView
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      card_view:cardCornerRadius="2dp"
      android:layout_margin="5dp">
...
</android.support.v7.widget.CardView>

No comments :

Post a Comment