【问题标题】:Recycler View overlaying screen contentRecyclerview 重叠屏幕内容
【发布时间】:2018-09-19 00:44:12
【问题描述】:

我正在为 android 制作一个屏幕,其中有一个带有 RecyclerView 的 NestedScrollView。但是,如果我在嵌套中放置一个回收站,它就不会出现。如果你把它收起来,它会占据整个屏幕空间。点击 pastebin 上 XML 文件的链接:https://pastebin.com/qVtHWWgw

意外的结果:

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

    <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="vertical"
       android:paddingLeft="@dimen/article_keylines"
       android:paddingRight="@dimen/md_keylines"
       android:paddingTop="@dimen/md_keylines">

        <TextView
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:textColor="?attr/colorAccent"
           android:text="@string/address"
           android:textSize="@dimen/article_titles"
           android:layout_marginBottom="@dimen/md_keylines"
           android:layout_marginTop="@dimen/md_keylines" />

        <TextView
           android:id="@+id/place_location"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content" />

        <TextView
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:textColor="?attr/colorAccent"
           android:text="@string/related_products"
           android:textSize="@dimen/article_titles"
           android:layout_marginBottom="@dimen/md_keylines"
           android:layout_marginTop="@dimen/md_keylines"
           android:id="@+id/related_products"/>
    </LinearLayout>
</android.support.v4.widget.NestedScrollView>


<android.support.v4.widget.SwipeRefreshLayout
   android:layout_width="match_parent"
   android:layout_height="match_parent">
    <android.support.v4.view.ViewPager
       android:id="@+id/viewpager"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
</android.support.v4.widget.SwipeRefreshLayout>

【问题讨论】:

  • 预期的结果是什么?
  • 向我展示您的屏幕截图或您预期结果的设计。
  • 回收站视图需要在橙色文字下方

标签: android xml android-recyclerview


【解决方案1】:

我通过将 NestedScrollView 替换为 RelativeLayout 解决了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-09
    • 1970-01-01
    • 1970-01-01
    • 2016-10-02
    • 2021-06-08
    • 1970-01-01
    相关资源
    最近更新 更多