Java – attach textview to recyclerview

I realize that the following is incorrect, but I think you can treat it as pseudocode I want to know how I attach an overall layout to my recyclerview so that when I scroll down, the layout will scroll with me At present, the textview above recyclerview has been fixed on the screen, and all data in recyclerview can be scrolled When the user scrolls down the page, I want the textview out of sight If you see instagram, all user profile information at the top of your gallery will disappear when you scroll down the page What shall I do? How do I add textview programmatically?

<TextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="Hello!" />

<android.support.v7.widget.RecyclerView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginBottom="?android:attr/actionBarSize"
    android:padding="@dimen/item_margin"
    android:id="@+id/recycler_view"
    android:clipToPadding="false">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="Hello!" />

</android.support.v7.widget.RecyclerView>

Solution

I use the same two great resources:

https://plus.google.com/114432517923423045208/posts/EdkQFx1RqhE

https://gist.github.com/gabrielemariotti/4c189fb1124df4556058

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>