最近在项目中使用Material Design 中的 AppBarLayout,然后在 NestedScrollView 中嵌套 ViewPager,但是运行的时候界面出现空白,代码如下:

<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <!-- Your scrolling content -->
    <androidx.viewpager.widget.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</androidx.core.widget.NestedScrollView>

 

解决方法:

在 NestedScrollView 的属性中增加如下属性:

android:fillViewport="true"

 

相关文章:

  • 2021-05-01
  • 2021-05-18
  • 2021-06-27
  • 2021-12-05
  • 2021-05-04
  • 2022-01-22
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2021-05-02
相关资源
相似解决方案