如何在Android中为TwoWayView制作适配器

问题描述

我无法从lucasar创建用于TwoWayView的适配器。 https://github.com/lucasr/twoway-view

我想要的是一种用于图像的Facebook风格的显示器。有点像这样。 facebook style image structure

我目前正在尝试将github仓库中位于示例文件夹下的LayoutAdapter.java文件转换为可以在我的项目中使用的适配器,但是我想我需要有关此适配器的功能的更多信息。 / p>

这是TwoWayView网格的xml。

<org.lucasr.twowayview.widget.TwoWayView
    android:id="@+id/twvGrid"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical"
    app:twowayview_layoutManager="SpannableGridLayoutManager"
    app:twowayview_numColumns="3"
    app:twowayview_numRows="3"
    android:layout_below="@+id/youtubeVidImage"
    android:layout_gravity="center"
    android:fitsSystemWindows="true"
    android:layout_marginTop="35dp"/>

布局中的每个项目(galleryItem)本质上只是要显示的图像的url。我希望能够将这些图像添加到设置TwoWayView的活动的布局中。此类活动用于初始化mPhotos数组的Activity中的代码

    private void initimagesRecyclerView(){
        Log.d(TAG,"initimagesRecyclerView: init Recyclerview");
        imagesRecyclerView = findViewById(R.id.twvGrid);
        mPhotos =  new ArrayList<galleryItem>();
        //mImagePostsAdapter = new ImagePostsAdapter(this,mPhotos);
        //imagesRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(1,StaggeredGridLayoutManager.HORIZONTAL));
        mImagePostsAdapter = new TwoWayViewAdapter(this,imagesRecyclerView,R.layout.layout_staggered_grid);
        imagesRecyclerView.setAdapter(mImagePostsAdapter);
    }

有人可以给我一些有关如何实现TwoWayView的建议吗?关于如何制作适配器以及如何在Activity中将其设置为TwoWayView引用的任何事情都很棒。

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...