zoukankan      html  css  js  c++  java
  • 在布局中使用android.support.v4.app.Fragment的注意事项

    1.Activity必须继承android.support.v4.app.FragmentActivity

    2.fragment标签的name属性必须是完全限定包名,如下:

     1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     2     android:layout_width="fill_parent"
     3     android:layout_height="fill_parent"
     4     android:orientation="vertical" >
     5 
     6     <fragment 
     7         android:name="com.example.v4fragmenttest.MyFragment"
     8         android:id="@+id/myfragmentid"
     9         android:layout_width="400px"
    10         android:layout_height="500px"
    11         android:layout_gravity="center"
    12         />
    13 
    14 
    15 </LinearLayout>

    3.

    onCreateView(LayoutInflater inflater,
    			@Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
    

      如果是在布局中使用Fragment,onCreateView方法的container参数是null

  • 相关阅读:
    四则运算1
    四则运算3
    数组1
    四则运算单元测试
    四则运算2
    数组3
    数组2
    spring aop对service层日志和异常的处理
    Linux设置开机启动
    数据仓库开发——Kettle使用示例
  • 原文地址:https://www.cnblogs.com/xxNote/p/5548432.html
Copyright © 2011-2022 走看看