kotlin 에서 화면 아래로 Pull Swipe 시에 새로고침 구현 - SwipeRefreshLayout > 개발

본문 바로가기

사이트 내 전체검색

뒤로가기 개발

kotlin 에서 화면 아래로 Pull Swipe 시에 새로고침 구현 - SwipeRefreshLayout

페이지 정보

작성자 관리자 (112.♡.173.204) 작성일 21-05-06 21:05 조회 2,688 댓글 0

본문

## 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

추천0

댓글목록 0

등록된 댓글이 없습니다.

전체 386건 7 페이지
게시물 검색
Copyright © Baragi.Net All rights reserved.
PC 버전으로 보기