항상 켜져 있는 디스플레이 검색 보기 없이 재활용 보기에서 검색하는 쉬운 방법입니다.
어떻게 작동하나요?
검색창이 있는 재활용 보기를 원한 적이 있나요? 이는 recyclerView를 내 사용자 정의 레이아웃으로 래핑할 수 있는 간단한 라이브러리입니다. 이 레이아웃은 리사이클러를 위/아래로 스크롤하여 표시할 수 있는 숨겨진 검색 보기를 제공합니다.
Android 프로젝트에 이 라이브러리를 포함하려면 gradle
사용해야 합니다.
compile ' com.nicolettilu:hiddensearchwithrecyclerview:0.0.5 '
작동 방식은 다음과 같습니다.
< com .nicolettilu.hiddensearchwithrecyclerview.HiddenSearchWithRecyclerView
android : layout_width = " match_parent "
android : layout_height = " match_parent " >
< androidx .recyclerview.RecyclerView
android : layout_width = " match_parent "
android : layout_height = " match_parent " />
</ com .nicolettilu.hiddensearchwithrecyclerview.HiddenSearchWithRecyclerView>
라이브러리가 제공하는 사용자 정의 레이아웃으로 RecyclerView
래핑해야 합니다. 현재 라이브러리는 다음 구성을 제공합니다.
< attr name = " filterWhileTyping " format = " boolean " /> <!-- default value: true -->
< attr name = " scrollToTopBeforeShow " format = " boolean " /> <!-- default value: false -->
< attr name = " scrollToBottomBeforeHide " format = " boolean " /> <!-- default value: false -->
< attr name = " visibleAtInit " format = " boolean " /> <!-- default value: false -->
< attr name = " hideAtScroll " format = " boolean " /> <!-- default value: true -->
XML 파일에서 해당 속성을 사용자 정의할 수 있습니다.
< com .nicolettilu.hiddensearchwithrecyclerview.HiddenSearchWithRecyclerView
android : id = " @+id/hidden_search_with_recycler "
android : layout_width = " match_parent "
android : layout_height = " match_parent "
app : scrollToBottomBeforeHide = " true "
app : scrollToTopBeforeShow = " true "
app : filterWhileTyping = " false "
app : visibleAtInit = " true " >
<!-- your RecyclerView here -->
</ com .nicolettilu.hiddensearchwithrecyclerview.HiddenSearchWithRecyclerView>
그리고 코드에서도:
val hiddenSearchWithInRecycler = findViewById( R .id.hidden_search_with_recycler) as HiddenSearchWithRecyclerView
hiddenSearchWithInRecycler.hideAtScroll = true
hiddenSearchWithInRecycler.visibleAtInit = false
hiddenSearchWithInRecycler.scrollToBottomBeforeHide = false
hiddenSearchWithInRecycler.scrollToTopBeforeShow = false
hiddenSearchWithInRecycler.filterWhileTyping = true
결과의 몇 가지 예는 다음과 같습니다.
기본 예 | SearchView 숨기거나 표시하기 전에 상단/하단으로 스크롤 | 초기화 예시에 표시된 SearchView |
---|---|---|
저작권 © 2018
Luca Nicoletti
본 소프트웨어 및 관련 문서 파일(이하 "소프트웨어")의 사본을 취득한 모든 사람에게 사용, 복사, 수정, 병합에 대한 권리를 포함하되 이에 국한되지 않고 제한 없이 소프트웨어를 취급할 수 있는 권한이 무료로 부여됩니다. , 소프트웨어 사본을 게시, 배포, 재라이센스 부여 및/또는 판매하고, 소프트웨어를 제공받은 사람에게 다음 조건에 따라 그렇게 하도록 허용합니다.
위의 저작권 고지와 본 허가 고지는 소프트웨어의 모든 사본 또는 상당 부분에 포함됩니다.
소프트웨어는 상품성, 특정 목적에의 적합성 및 비침해에 대한 보증을 포함하되 이에 국한되지 않고 명시적이든 묵시적이든 어떠한 종류의 보증 없이 "있는 그대로" 제공됩니다. 어떠한 경우에도 작성자나 저작권 보유자는 계약, 불법 행위 또는 기타 행위로 인해 소프트웨어나 사용 또는 기타 거래와 관련하여 발생하는 모든 청구, 손해 또는 기타 책임에 대해 책임을 지지 않습니다. 소프트웨어.