Mar*_*lic 9 java xml android android-recyclerview recyclerview-layout
我意识到以下是不正确的,但我想你可以把它当作伪代码.我想知道,如何将整个布局"附加"到我的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>
Run Code Online (Sandbox Code Playgroud)
小智 7
您可以尝试Android-ObservableScrollView.
请参阅以下链接:https: //github.com/ksoichiro/Android-ObservableScrollView
小智 7
我使用这两个很好的资源做了同样的事情:
https://plus.google.com/114432517923423045208/posts/EdkQFx1RqhE
https://gist.github.com/gabrielemariotti/4c189fb1124df4556058
你可以使用自定义添加它TextView
作为其中一个RecyclerView
项目,RecyclerAdapter
或者你可以使用ScrollView
with LinearLayout
作为其内容,而不是RecyclerView
因为它不建议在一个内部使用ScrollView
.
归档时间: |
|
查看次数: |
7001 次 |
最近记录: |