Space的使用
来源:互联网 发布:希捷同步软件 编辑:程序博客网 时间:2024/05/18 01:05
介绍
Space常用于布局中组件之间的间隔,draw(Canvas canvas)方法为空,没有进行view绘制,所以space提高了绘制效率,正因为draw(Canvas canvas)实现为空,所以Space不能设置背景色
源码
public final class Space extends View { public Space(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super((Context)null, (AttributeSet)null, 0, 0); throw new RuntimeException("Stub!"); } public Space(Context context, AttributeSet attrs, int defStyleAttr) { super((Context)null, (AttributeSet)null, 0, 0); throw new RuntimeException("Stub!"); } public Space(Context context, AttributeSet attrs) { super((Context)null, (AttributeSet)null, 0, 0); throw new RuntimeException("Stub!"); } public Space(Context context) { super((Context)null, (AttributeSet)null, 0, 0); throw new RuntimeException("Stub!"); } public void draw(Canvas canvas) { throw new RuntimeException("Stub!"); } protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { throw new RuntimeException("Stub!"); }}
使用
android.support.v7.widget.Space
android.support.v4.widget.Space
Space
v7包的已经废弃,可以直接使用Space,也可以导入v4包,如果已经导入v7或v13包,不用再导入v4,因为v7,v13包中包含v4
<Space android:layout_width="match_parent" android:layout_height="15dp" />
<android.support.v4.widget.Space android:layout_width="match_parent" android:layout_height="10dp" />
截图效果:
阅读全文
1 0
- Space的使用
- dump_stack的简单使用 [Kernel space]
- android的Space控件使用方式
- jsp项目中使用dwr引起的Java heap space
- 不能使用ctrl+space切换中英文输入法的问题
- 使用shrink space降低表的高水位线
- 我的MSN Space
- lengfo的 live space
- space的终结
- PermGen Space的解决办法
- PermGen space的异常
- MSN Space 使用高级技巧
- 表空间space使用查询
- Linux callstack 使用 [User space]
- sed命令简单使用-pattern space与hold space
- space
- space
- 完美解决无法使用ctrl+shift以及ctrl+space切换输入法的问题
- checkbox的全选
- 用户认证
- angular的ng-grid使用中遇到的一些坑
- oracle 数据库提高查询的方法
- 题目描述:给定一个字符串,求出其所有可能的字符组合. 比如:abc 其所有组合是:a,b,c,ab,ac,bc,abc
- Space的使用
- 【深入理解计算机系统01】不同层级程序指令间的转换
- 搭建虚拟机Hadoop环境时ssh遇到port 22:No route to host解决办法
- 查看本机ip
- 数学笔记——导数4(反函数的导数)
- Android 检测正在运行的service
- Servlet 编写过滤器
- Ajax基础(2)
- maven--私服的搭建(Nexus的使用)