viewpager不显示
2015-09-21 06:48
369 查看
<?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:orientation="vertical" > <com.example.shijianlanjie.scrollChangeView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/scv"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <android.support.v4.view.ViewPager android:id="@+id/viewPager" android:layout_width="200dp" android:layout_height="200dp" > </android.support.v4.view.ViewPager> </LinearLayout> </com.example.shijianlanjie.scrollChangeView> </LinearLayout>
如果将Viewpager的layout_width和layout_height设置为match_parent结果什么都不显示,不知道viewpager的源码是怎么判断宽高的
通常onmeasure有三种类型,MOST为最大要多少,unspecified基本没有意义,还有EXACTLY类型,match_parent应该是EXACTLY的类型,就是父空间有多少,就占据多少,但是这里显示为0
可能和外部嵌套的scrollChangeView有关,这是一个自定义布局,继承Horizonscrollview,这种伸缩布局似乎即使是设置为match_parent,原始大小其实也是0,因为大小是随着子view而不断改变的,所以其实可能相当于wrap_content,原始大小其实是0
相关文章推荐
- 写几十行代码,来一场无鼠标编程之旅,看看who is e———(HTML5:HBuilder5.0.0)
- 在win7系统的电脑上安装CentOS7双系统
- 2015年9月14日--9月20日(30小时,剩3485小时)
- UIPercentDrivenInteractiveTransition Controller交互式转场切换动画
- 新的开始
- android给未签名的apk签名
- C++类的const, static 和inline成员函数(变量)
- 如何获取帮助———— QQ群讨论摘要
- Best Time to Buy and Sell Stock II 解答
- 【软剑攻城队】团队介绍发布!
- 内核随记(一)——理解中断(2)
- [LeetCode]Different Ways to Add Parentheses
- 人类是否能够接受人工智能(AI)的存在?
- php 参数传递
- 内核随记(一)——理解中断(1)
- LeetCode Reverse Words in a String
- LeetCode Simplify Path
- linux0.11下的中断机制分析
- Android:Activity生命周期
- Best Time to Buy and Sell Stock 解答