【发布时间】:2017-09-27 09:58:15
【问题描述】:
我想知道是否有办法让我在 android 中自定义 gridlayoutmanager,使其具有像这样的草图的水平布局:
我尝试了一些在 Github 中找到的布局管理器,但没有一个可以帮助我实现这种布局管理器。
类似这样的:
public class CustomLayoutManager extends StaggeredGridLayoutManager {
public CustomLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public CustomLayoutManager(int spanCount, int orientation) {
super(spanCount, orientation);
}
@Override
public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) {
super.onMeasure(recycler, state, widthSpec, heightSpec);
}
@Override
public void setSpanCount(int spanCount) {
super.setSpanCount(spanCount);
}}
任何帮助将不胜感激 谢谢
【问题讨论】:
-
您可以在适配器中使用多种类型的布局。
-
我无权更改适配器设置。它在安卓电视环境中
-
如果我的回答对您有帮助,请将其标记为已接受。 :)
-
只是需要时间检查一下 :) 再次感谢
标签: android layout-manager gridlayoutmanager staggeredgridlayout