为电视应用程序创建了双向滚动网格布局
来自布局文件的视图结构
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#021257"
android:orientation="vertical">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rvThumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#021257"
android:orientation="vertical"/>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>因此,我使用网格管理器(方向垂直)和跨度计数为49 (24小时*2)+1的图像显示列。第一行是显示时间线,分为半小时时隙,第一列显示通道,每个通道将有自己的程序在不同时隙下运行。现在我已经实现了两种方式滚动网格布局,现在我还有两件事要做。

1)当水平滚动时,通道列(第一列)也会被滚动,从而被隐藏(但是它必须垂直滚动,因为可以有20+通道)。现在,我需要使这个列保持水平滚动,而rest其他列必须正常滚动。
2)当垂直滚动时,时间线行(第一行)也会被滚动,因此会被隐藏(但它必须水平滚动,因为该行必须显示24小时)。现在,我需要使该行静态wen垂直滚动,而rest其他行必须正常滚动。
这是可能的吗?我感谢你的帮助
发布于 2017-12-27 12:37:59
可行的方法是采用三个循环视图。
(A)通道列表的垂直循环视图
(B)时间列表的水平循环视图
C)数据的网格布局管理器的循环视图
使用网格循环视图的scrollChange监听器(用于数据的回收视图)
/**
* Use scroll values
*/
public void setScroll() {
mDataRecycleView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
@Override
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
//you can now play on scroll value of this recycle view and change the scroll value of other recycle views.
// you can get your view here and also know the value of view so based on value you can handle it here so it's very easy.
}
});
}试着让我知道这个方法是否适合你,如果有任何查询,然后在下面评论,这样我们就可以解决你的问题了。
发布于 2018-01-02 14:17:53
尝试一下来自Github的TableView项目。
TableView是一个功能强大的安卓库,用于显示复杂的数据结构和呈现由行、列和单元格组成的表格数据。TableView依赖于一个单独的模型对象来保存和表示它显示的数据。这个存储库还包含一个示例应用程序,旨在向您展示如何在应用程序中创建您自己的TableView。
从这个项目中获取概念并修改您想要的内容。
希望这个解释能帮助你:)
https://stackoverflow.com/questions/47912918
复制相似问题