简体   繁体   中英

Recycler View overlaying screen content

I'm making a screen for android, where it has a NestedScrollView with a RecyclerView. However if I place a recycle inside the nested it does not appear. If you put it away, it takes up the entire screen space. Follow the link to XML File on pastebin: https://pastebin.com/qVtHWWgw

unexpected result:

在此处输入图片说明

<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>

我通过用RelativeLayout替换NestedScrollView来解决

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM