나는이 CoordinatorLayout
정의와보기를 포함하는 CoordinatorLayout.Behavior
(item_search_button을)과 SwipeRefreshLayout
을 함유 NestedScrollView
. 사용자 정의보기는 일반 스크롤을 사용하여 화면 밖으로 스크롤해야하지만 사용자가 목록을 위로 스크롤하자마자 나타나야하는 (위에서 스크롤) 버튼입니다. 이것은 예상대로 작동합니다. 내 문제는의 새로 고침 표시기가 SwipeRefreshLayout
사용자 정의보기 item_search_button 뒤에 표시된다는 것입니다.
<android.support.design.widget.CoordinatorLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar_startpage"
app:snackbar="@{offlineSnackbarVM.snackbarData}">
<include
layout="@layout/item_search_button"
app:vm="@{searchButtonVM}"/>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:refreshing="@{reloadVM.refreshInProgress}">
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/elementsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/spacing_48"/>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>
item_search_button.xml :
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data class="SearchButtonBinding">
<variable
name="viewmodel"
type="vm.SearchButtonVM"/>
</data>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="behaviors.ScrollSnapBehavior"
android:layout_margin="@dimen/spacing_8"
android:onClick="@{() -> vm.openSearch()}">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/leftIcon"
app:layout_constraintRight_toLeftOf="@+id/rightIcon"
app:layout_constraintTop_toTopOf="parent"/>
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
</layout>
하지만 항목 전에 그것을 원합니다. 어떻게 해결할 수 있습니까?
마지막으로 해결 방법으로 문제를 해결했습니다.
translationX
있는지 여부를 설정 하여 인디케이터가 카드 뷰 위에 표시되도록합니다.setProgressViewOffset()
오프셋을 증가시키고 불쾌한 플리커 효과를 방지하기 위해 cardview 아래에 페인트.나를 위해 작동합니다 ...
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다