Usage
This section provides detailed usage guidelines for Loadify components, including XML integration, attributes, prerequisites, and common errors.
Introduction
The Loadify library offers a variety of customizable and visually appealing UI loaders. You can easily integrate these loaders into your Android app's layouts and adjust their attributes to match your app's design language.
This section provides an in-depth guide on using Loadify loaders, covering XML integration, prerequisites, attributes, and troubleshooting tips.
Prerequisites
Before using Loadify components in your project, ensure the following prerequisites are met:
- Library Integration: The Loadify library must be added to your project. Refer to the Installation Guide if you haven't done so.
- Android Project Setup: Ensure you have a properly configured Android project with Kotlin support.
- Attribute Customization: Familiarize yourself with XML attributes to customize the loaders as per your needs.
XML Integration
Loadify loaders are designed for seamless integration into your Android layouts. You can directly include the desired loader component in your XML layout file. Each loader comes with attributes for easy customization.
Available Loaders and Attributes
Below are the available loaders with their respective attributes and use cases.
1. CircularLoaderView
<com.hariomharsh.loaders.ui.CircularLoaderView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:circle_color="@color/primaryColor"
app:circle_size="48dp"
app:circle_speed="150"
app:circle_stroke="4dp" />
Attributes:
circle_color: Sets the color of the circle.circle_size: Defines the size of the circle.circle_speed: Adjusts the animation speed.circle_stroke: Specifies the thickness of the circle stroke.
2. LineSpinnerView
<com.hariomharsh.loaders.ui.LineSpinnerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:line_color="@color/secondaryColor"
app:line_size="64dp"
app:line_stroke="3dp"
app:line_speed="200" />
Attributes:
line_color: Sets the color of the spinner lines.line_size: Defines the overall size of the spinner.line_stroke: Adjusts the thickness of the lines.line_speed: Controls the animation speed.
3. TailChaseSpinner
<com.hariomharsh.loaders.ui.TailChaseSpinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:spinner_color="@color/accentColor"
app:spinner_size="50dp"
app:spinner_dot_size="1.5" />
Attributes:
spinner_color: Specifies the color of the tail spinner.spinner_size: Defines the size of the spinner.spinner_dot_size: Sets the size of the dots.
4. ThreeDotsPyramid
<com.hariomharsh.loaders.ui.ThreeDotsPyramid
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:pyramid_color="@color/primaryDarkColor"
app:pyramid_size="60dp" />
Attributes:
pyramid_color: Sets the color of the pyramid dots.pyramid_size: Defines the size of the pyramid.
5. DotPulse
<com.hariomharsh.loaders.ui.DotPulse
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:dot_color="@color/highlightColor"
app:dot_size="12dp"
app:dot_spacing="8dp"
app:dot_count="3"
app:dot_speed="300" />
Attributes:
dot_color: Sets the color of the dots.dot_size: Specifies the size of the dots.dot_spacing: Adjusts the spacing between dots.dot_count: Defines the number of dots.dot_speed: Controls the speed of the animation.
Common Errors and Troubleshooting
-
Dependency Not Found:
- Ensure the JitPack repository is added to your
settings.gradleor project-levelbuild.gradle. - Double-check the library version specified in the dependency.
- Ensure the JitPack repository is added to your
-
Attributes Not Recognized:
- Verify that you’re using the correct namespace (
app:). - Ensure the attribute names match the ones documented.
- Verify that you’re using the correct namespace (
-
Loader Not Displaying Properly:
- Check your layout dimensions (
wrap_contentor specific sizes). - Ensure the attribute values are valid (e.g., positive numbers for size and speed).
- Check your layout dimensions (
Next Steps
For further assistance, raise an issue on our GitHub Repository. Happy coding!