Skip to content

Commit 938d1fc

Browse files
authored
Add implementation steps
1 parent 9b69a54 commit 938d1fc

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,38 @@ A component view to help lazy load any view component (using layout resource ID)
44
Disclaimer: For better visual purpose, this demo uses 1 second of delay and color to help you to understand how this lazy load component works
55

66
![Demo](https://github.com/WendyYanto/android-lazy-load-component/blob/master/assets/demo.gif)
7+
8+
## Implementation Steps
9+
10+
1. This library has already been included in jitpack.io. In order to use it, you should add it in your root build.gradle at the end of repositories:
11+
```
12+
allprojects {
13+
repositories {
14+
...
15+
maven { url 'https://jitpack.io' }
16+
}
17+
}
18+
```
19+
2. Add the dependency
20+
```
21+
dependencies {
22+
implementation 'com.github.WendyYanto:android-lazy-load-component:v1.0.0'
23+
}
24+
```
25+
3. Include LazyLoadComponent in your XML layout (best recommended to use in `ScrollView`)
26+
```xml
27+
<dev.wendyyanto.library.LazyLoadComponent
28+
android:layout_width="match_parent"
29+
android:layout_height="10dp" />
30+
```
31+
4. Add the required attribute at LazyLoadComponent:
32+
- `app:layout_id`: The layout that is intended to be loaded lazily at runtime
33+
- `app:parent_layout_id`: The root layout's ID (it is used for LazyLoadComponent to decide when to load at runtime if only it's already on the viewport or beyond)
34+
35+
```xml
36+
<dev.wendyyanto.library.LazyLoadComponent
37+
android:layout_width="match_parent"
38+
android:layout_height="10dp"
39+
app:layout_id="@layout/layout_you_want_to_load_lazyily"
40+
app:parent_layout_id="@id/root_layout_id" />
41+
```

0 commit comments

Comments
 (0)