kotlin 에서 화면 아래로 Pull Swipe 시에 새로고침 구현 - SwipeRefreshLayout
페이지 정보
본문
## build.gradle
아래 처럼 추가한다.
```
dependencies {
// ...
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
}
```
https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout?hl=ko
## activity_main.xml
xml 코드를 아래처럼 refresh 할 것을 감싸고 작성한다.
```
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvItems"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
```
https://guides.codepath.com/android/implementing-pull-to-refresh-guide
## 참고
https://guides.codepath.com/android/implementing-pull-to-refresh-guide
https://www.tutorialspoint.com/how-to-create-a-swipe-refresh-layout-in-android-using-kotlin
https://android--code.blogspot.com/2018/02/android-kotlin-swiperefreshlayout.html
아래 처럼 추가한다.
```
dependencies {
// ...
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
}
```
https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout?hl=ko
## activity_main.xml
xml 코드를 아래처럼 refresh 할 것을 감싸고 작성한다.
```
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvItems"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
```
https://guides.codepath.com/android/implementing-pull-to-refresh-guide
## 참고
https://guides.codepath.com/android/implementing-pull-to-refresh-guide
https://www.tutorialspoint.com/how-to-create-a-swipe-refresh-layout-in-android-using-kotlin
https://android--code.blogspot.com/2018/02/android-kotlin-swiperefreshlayout.html
추천0
댓글목록
등록된 댓글이 없습니다.