Skip to content

Instantly share code, notes, and snippets.

@enginebai
Created May 26, 2015 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enginebai/bab2c77f60da2aace5f1 to your computer and use it in GitHub Desktop.
Save enginebai/bab2c77f60da2aace5f1 to your computer and use it in GitHub Desktop.
CardView + Ripple
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
android:id="@+id/card_movie_list_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
card_view:cardCornerRadius="4dp"
card_view:cardPreventCornerOverlap="false">
<com.balysv.materialripple.MaterialRippleLayout
android:id="@+id/ripple"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mrl_rippleBackground="@android:color/white"
app:mrl_rippleColor="@color/primary"
style="@style/Ripple"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- add you ui components -->
</LinearLayout>
</com.balysv.materialripple.MaterialRippleLayout>
</android.support.v7.widget.CardView>
@enginebai
Copy link
Author

style="@style/Ripple"

<style name="Ripple">
    <item name="mrl_rippleOverlay">true</item>
    <item name="mrl_rippleDuration">400</item>
    <item name="mrl_rippleRoundedCorners">10dp</item>
    <item name="mrl_rippleDelayClick">true</item>
</style>

@enginebai
Copy link
Author

app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "com.rey.material.demo"
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 2
        versionName "0.0.2"
    }




}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.2'
    compile 'com.android.support:cardview-v7:21.0.2'
    compile project(':lib')
    compile 'com.squareup.picasso:picasso:2.5.0'
}

@enginebai
Copy link
Author

lib/build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.2'
    compile 'com.android.support:cardview-v7:21.0.2'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment