FragmentActivity onCreateView [英] FragmentActivity onCreateView
问题描述
我尝试使用Android兼容性库(或者现在叫支持库)V4为pre-蜂窝Android设备。我明白,而是采用分片类,我应该使用FragmentActivity类。根据所有的教程我能找到,我可以使用 onCreateView 方法,在片段类:
I try to use the Android compatibility library (or now called the support library) v4 for pre-honeycomb android devices. I understand that, instead of using the Fragment class, I should use the FragmentActivity class. According to all the tutorials I can find, I can use the onCreateView method as in the Fragment class:
的 公开查看onCreateView(LayoutInflater充气器,容器的ViewGroup,捆绑savedInstanceState)的
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
然而,在FragmentActivity的onCreateView方法似乎是不同的。一个我继承的是:
However, the onCreateView method in the FragmentActivity seems to be different. The one I inherit from is:
的 公开查看onCreateView(字符串名称,上下文的背景下,ATTRS的AttributeSet)的
public View onCreateView (String name, Context context, AttributeSet attrs)
此版本实际上是在FragmentActivity类的Android的参考上市。结果
似乎所有的教程我能找到没有说明这种差异,并且都调用一个在片段类。
我是不是弄错的东西在这里,我应该以某种方式能够调用的片段类版本的onCreateView?
This version is actually listed in the Android reference of the FragmentActivity class.
Seems all tutorials I can find do not state this difference, and all are calling the one in the Fragment class.
Am I mistaking something here that I should be somehow able to call the onCreateView of the Fragment class version?
推荐答案
我认为这是错误的:
我明白,而是采用分片类,我应该使用FragmentActivity类。
I understand that, instead of using the Fragment class, I should use the FragmentActivity class.
您应该使用FragmentActivity类insted的Activity类的。在FragmentAcivity类是不够,你重写onCreate方法。
You should use FragmentActivity class insted of Activity class. In FragmentAcivity class it's enough that you override onCreate method.
这篇关于FragmentActivity onCreateView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!