RippleView
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)
Top Related Projects
Implementation of Ripple effect from Material Design for Android API 9+
Android L Ripple effect wrapper for Views
This is a library with components of Android L to you use in android 2.2
A beautiful ripple animation for your app
Lollipop ViewAnimationUtils.createCircularReveal for everyone 4.0+
Quick Overview
RippleView is an Android library that provides a custom view with a ripple animation effect. It allows developers to easily add interactive, material design-inspired ripple animations to their Android applications, enhancing the user experience with visual feedback for touch events.
Pros
- Easy integration into existing Android projects
- Customizable ripple color and duration
- Supports both circular and rectangular ripple shapes
- Compatible with Android API level 14 and above
Cons
- Limited to a single ripple effect style
- May not be actively maintained (last update was several years ago)
- Lacks advanced features like multiple simultaneous ripples
- Documentation could be more comprehensive
Code Examples
- Basic RippleView implementation:
<com.andexert.library.RippleView
android:id="@+id/rippleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ripple:rv_color="#FFFFFF">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Click me" />
</com.andexert.library.RippleView>
- Customizing ripple properties in XML:
<com.andexert.library.RippleView
android:id="@+id/customRippleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ripple:rv_color="#FF0000"
ripple:rv_centered="true"
ripple:rv_rippleDuration="1000"
ripple:rv_type="rectangle">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Custom Ripple" />
</com.andexert.library.RippleView>
- Handling ripple events in Java:
RippleView rippleView = findViewById(R.id.rippleView);
rippleView.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
@Override
public void onComplete(RippleView rippleView) {
Toast.makeText(MainActivity.this, "Ripple effect completed", Toast.LENGTH_SHORT).show();
}
});
Getting Started
- Add the JitPack repository to your project's
build.gradle
file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency to your app's
build.gradle
file:
dependencies {
implementation 'com.github.siriscac:RippleView:1.0.0'
}
- Use the RippleView in your XML layout files as shown in the code examples above.
Competitor Comparisons
Implementation of Ripple effect from Material Design for Android API 9+
Pros of RippleEffect
- More customizable with options for ripple color, duration, and fade duration
- Supports both circular and rectangular ripple shapes
- Includes a demo app showcasing various use cases
Cons of RippleEffect
- Requires more setup and configuration compared to RippleView
- May have a slightly higher performance overhead due to additional customization options
Code Comparison
RippleEffect:
RippleView rippleView = (RippleView) findViewById(R.id.ripple);
rippleView.setRippleColor(Color.parseColor("#ff0000"));
rippleView.setRippleDuration(1000);
rippleView.setRippleFadeDuration(500);
RippleView:
RippleView rippleView = (RippleView) findViewById(R.id.ripple);
rippleView.setRippleColor(Color.parseColor("#ff0000"));
rippleView.setRippleDuration(1000);
Summary
RippleEffect offers more customization options and flexibility in terms of ripple shapes and animations. It provides a comprehensive demo app, which can be beneficial for developers looking to implement various ripple effects. However, this comes at the cost of slightly more complex setup and potentially higher performance overhead.
RippleView, on the other hand, offers a simpler implementation with fewer customization options. It may be more suitable for projects that require a basic ripple effect without the need for extensive customization.
Both libraries achieve the goal of creating ripple effects in Android applications, but the choice between them depends on the specific requirements of the project and the desired level of customization.
Android L Ripple effect wrapper for Views
Pros of material-ripple
- More comprehensive implementation of Material Design ripple effect
- Supports both circular and rectangular ripples
- Offers more customization options for ripple behavior and appearance
Cons of material-ripple
- Slightly more complex setup and integration process
- May have a higher performance impact due to more advanced features
Code Comparison
RippleView:
RippleView rippleView = (RippleView) findViewById(R.id.rect);
rippleView.setRippleColor(Color.parseColor("#ff0000"));
rippleView.setRippleDuration(300);
material-ripple:
MaterialRippleLayout.on(view)
.rippleColor(Color.parseColor("#ff0000"))
.rippleDuration(300)
.create();
Summary
Both RippleView and material-ripple provide ripple effect implementations for Android applications. material-ripple offers a more feature-rich and customizable solution, adhering closely to Material Design principles. It supports both circular and rectangular ripples, which may be beneficial for various UI elements. However, this comes at the cost of a slightly more complex setup process and potentially higher performance overhead.
RippleView, on the other hand, provides a simpler implementation that may be easier to integrate for basic use cases. It may have a lower performance impact but offers fewer customization options compared to material-ripple.
The choice between the two libraries depends on the specific requirements of your project, such as the level of customization needed and performance considerations.
This is a library with components of Android L to you use in android 2.2
Pros of MaterialDesignLibrary
- Offers a wider range of Material Design components and widgets
- Provides more comprehensive implementation of Material Design principles
- Includes additional features like custom fonts and color schemes
Cons of MaterialDesignLibrary
- Larger library size, potentially increasing app size and complexity
- May require more setup and configuration to use effectively
- Less focused on a single specific effect (like ripple)
Code Comparison
RippleView:
RippleView rippleView = (RippleView) findViewById(R.id.ripple);
rippleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Handle click event
}
});
MaterialDesignLibrary:
ButtonFlat buttonFlat = new ButtonFlat(this);
buttonFlat.setText("Button");
buttonFlat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Handle click event
}
});
The code comparison shows that RippleView focuses specifically on implementing a ripple effect, while MaterialDesignLibrary provides a broader range of Material Design components, such as the ButtonFlat in this example. RippleView's implementation is simpler and more targeted, while MaterialDesignLibrary offers more comprehensive Material Design elements but may require more setup and customization.
A beautiful ripple animation for your app
Pros of android-ripple-background
- More customizable with options for ripple color, stroke width, and ripple count
- Supports both circular and rectangular ripple shapes
- Includes animation duration and scale control
Cons of android-ripple-background
- Larger codebase, potentially more complex to implement
- May have higher performance overhead due to additional features
Code Comparison
RippleView:
RippleView rippleView = (RippleView) findViewById(R.id.ripple);
rippleView.startRippleAnimation();
android-ripple-background:
RippleBackground rippleBackground = (RippleBackground) findViewById(R.id.content);
rippleBackground.startRippleAnimation();
rippleBackground.stopRippleAnimation();
Summary
android-ripple-background offers more customization options and flexibility in terms of ripple shapes and animation control. However, this comes at the cost of a larger codebase and potentially higher complexity. RippleView provides a simpler implementation but with fewer customization options. The choice between the two depends on the specific requirements of the project and the desired level of control over the ripple effect.
Lollipop ViewAnimationUtils.createCircularReveal for everyone 4.0+
Pros of CircularReveal
- Supports circular reveal animations on views and activities
- Provides more customization options for reveal effects
- Offers backward compatibility for pre-Lollipop devices
Cons of CircularReveal
- More complex implementation compared to RippleView
- Requires additional setup for pre-Lollipop devices
- May have performance issues on older devices
Code Comparison
CircularReveal:
ViewAnimationUtils.createCircularReveal(
view,
centerX,
centerY,
startRadius,
endRadius
).start();
RippleView:
RippleView rippleView = (RippleView) findViewById(R.id.ripple_view);
rippleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
rippleView.animateRipple();
}
});
CircularReveal offers more control over the animation parameters, allowing developers to specify the center point and radii. RippleView, on the other hand, provides a simpler implementation with a predefined ripple effect.
Both libraries aim to enhance the visual feedback of user interactions, but CircularReveal offers more flexibility at the cost of increased complexity. RippleView is easier to implement but has limited customization options compared to CircularReveal.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
RippleView
View that imitates Ripple Effect on click which was introduced in Android L.
Usage
For a working implementation, Have a look at the Sample Project - RippleViewExample
-
Include the library as local library project.
-
Include the RippleView widget in your layout.
<com.indris.material.RippleView android:id="@+id/btn" android:layout_width="match_parent" android:layout_height="match_parent" ripple:alphaFactor="0.7" ripple:rippleColor="#58FAAC" > </com.indris.material.RippleView>
-
In your
onCreate
method refer to the View and add 'OnClickListener' for the same.mButton = (RippleView) findViewById(R.id.btn); mButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //your code } });
Customization
There are three attributes which are applicable to RippleView
.
-
rippleColor
Color of the Ripple -
alphaFactor
Opacity of the Ripple -
hover
Hover effect on the button -
You can also set these attributes from your java code by calling
setRippleColor(rippleColor, alphaFactor)
andsetHover(enabled)
respectively.
Compatibility
- Android GingerBread 2.3+
Changelog
Current Version: 1.2
- Added option to enable or disable Hover
- Added GingerBread Support
- Bug fixes
Version: 1.1
- Improved Animation
- Added Hover Effect (Thanks to YangHui)
Version: 1.0
- Initial Build
Author
- Muthuramakrishnan - siriscac@gmail.com
Credits
License
Copyright 2014 Muthuramakrishnan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Top Related Projects
Implementation of Ripple effect from Material Design for Android API 9+
Android L Ripple effect wrapper for Views
This is a library with components of Android L to you use in android 2.2
A beautiful ripple animation for your app
Lollipop ViewAnimationUtils.createCircularReveal for everyone 4.0+
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot