Android的Fragment的学习和使用

来源:互联网 发布:linux etc 编辑:程序博客网 时间:2024/06/08 00:37

学习使用Fragment。

1,Fragment是什么?

为了让界面可以在平板上更好地展示,Android在3.0版本引入了Fragment(碎片)功能,它非常类似于Activity,可以像 Activity一样包含布局。

2,Fragment有什么用?

为了满足平板等大屏显示。

3,怎么使用Fragment?

All subclasses of Fragment must include a public no-argument constructor. The framework will often re-instantiate a fragment class when needed, in particular 
during state restore, and needs to be able to find this constructor to instantiate it. If the no-argument constructor is not available, 
a runtime exception will occur in some cases during state restore. 

所有Fragment子类必须包含一个公共的无参构造器。当系统需要的时候,Fragment子类经常都要重新实例化对象,特别是在状态恢复期间,需要能够找到这个构造器来实例化它。

0 0
原创粉丝点击