[英]how to scroll over image in recycler view
我是android編程的新手,我正在嘗試在圖像上滾動我的回收站視圖
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootRL"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="160dp"
android:background="@drawable/mydrawable">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="160dp"
android:id="@+id/rv"/>
</FrameLayout>
當我滾動時,“回收者”視圖會在圖像上方滾動而不是在其上方。我如何實現此效果?
嘗試這個:-
通過設置backgroundImage使用FrameLayout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootRL"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="160dp"
android:background="@drawable/tips"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
通過設置backgroundImage使用LinearLayout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootRL"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="160dp"
android:background="@drawable/tips"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
通過設置backgroundImage使用RelativeLayout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootRL"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="160dp"
android:background="@drawable/tips">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
將RelativeLayout與ImageView結合使用:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootRL"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="160dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/tips" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.