Android开发 Fragment+RecycleView有个坑
来源:互联网 发布:java,建立string 编辑:程序博客网 时间:2024/05/07 12:56
有一个横向的顶部tab+viewpage布局显示的界面,然后在viewpage里面使用的Fragment的,每一个Fragment里面基本上都是RecycleView,写完了之后发现在ViewPage里面左右一直滑动,会导致Fragment里面的布局越来越小,一直查也没有找到原因,细看代码发现是给RecycleView添加了item间距导致
private void initRecycleView() { WrapContentLinearLayoutManager linearLayoutManager = new WrapContentLinearLayoutManager(getContext()); linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); rlv.setLayoutManager(linearLayoutManager); //下面这行代码会导致左右滑动的时候布局越来越小。。。// rlv.addItemDecoration(new SpacesItemDecoration(20)); adapter = new SocialSecurityAdapter(getContext()); adapter.setData(data); rlv.setAdapter(adapter);
————————————————–2017年11月27日14:57:04——————————————————
阅读全文
0 0
- Android开发 Fragment+RecycleView有个坑
- android基础开发之RecycleView
- Android 开发之RecycleView的简单使用
- android开发 使用RecycleView加载数据
- Android开发RecycleView的Item分割线
- ViewPager嵌套RecycleView(Fragment作为数据源)来展示10条数据,每个Item显示的内容是(Android软件开发工程师)(用自定义的Adapter 实现
- android recycleView
- Android RecycleView
- Android-RecycleView
- Android开发之Fragment
- 初学android开发--Fragment
- Android应用开发:Fragment
- Android开发---Fragment使用指南
- android开发之Fragment
- Android开发之fragment
- android开发-Fragment生命周期
- Android开发 AndroidStudio添加RecycleView,解决预览失败
- android开发 RecycleView之No adapter attached; skipping layout
- Java ThreadLocal源码分析
- SpringMVC重定向传参数的实现
- 剑指offer-判断二叉树B是不是包含二叉树A
- 使用Maven搭建Struts2+Spring3+Hibernate4的整合开发环境
- cocos2dx lua和c++纹理平铺
- Android开发 Fragment+RecycleView有个坑
- 7-7(排序) Windows消息队列(25 分)
- Linux下搭建FTP服务器(Ubuntu16.04)
- JS——坑5
- 15 内核里leds-gpio设备驱动的设备树方法
- Elasticsearch 5.1.1搜索高亮及Java API实现
- 数据卷的相关命令
- 深拷贝与浅拷贝的区别
- 手机端自适应布局demo