【发布时间】:2019-03-16 06:51:04
【问题描述】:
由于我在布局中需要一些动画和过渡,我在 NestedScrollView 中有一个 Web 视图。现在问题是垂直滚动工作得非常好(我猜这是由于嵌套滚动视图的滚动而不是 Web 视图的滚动),但水平滚动是平滑的。水平滚动与 webview 内内容的水平滚动一样(比如 webview 内的轮播)。
这是我的布局:-
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.SearchView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="@color/white"
app:layout_scrollFlags="scroll|enterAlways" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/activity_main_swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
<WebView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<fr.castorflex.android.smoothprogressbar.SmoothProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="3.5dp"
android:indeterminate="true"
app:layout_constraintTop_toTopOf="parent"
app:spb_color="#FB9043"
app:spb_mirror_mode="false"
app:spb_reversed="false"
android:layout_marginTop="60dp"
app:spb_sections_count="5"
app:spb_speed="1.0"
app:spb_stroke_separator_length="4.0dp"
app:spb_stroke_width="4.0dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
谁能帮我解决这个问题?
【问题讨论】:
标签: android webview android-coordinatorlayout android-nestedscrollview