java – 将TextView附加到RecyclerView

我意识到以下是不正确的,但我想你可以将其视为伪代码.我想知道,我如何将一个整体布局附加到我的RecyclerView中,以便当我向下滚动时,布局会随之滚动.目前,RecyclerView上面的TextView已经在屏幕上固定,而RecyclerView中的所有数据都是可滚动的.当用户向下滚动页面时,我希望TextView移出视线.如果您看到Instagram,您的画廊顶部的所有用户个人资料信息将在您向下滚动页面时消失.我该怎么做?如何以编程方式添加TextView?
<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>

解决方法

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...