zoukankan      html  css  js  c++  java
  • 安卓入门教程(十五)- Fragment,Service,WAMP下载

    Fragment概述


    Fragment可以被嵌入到Activity中,一个Activity可以有多个Fragment。


    创建Fragment

    public class MyFragment extends Fragment{
    @Override
    publicc View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
    Viw v = inflater.inflate(R.layout.fragment,null);
    return v;
    }
    }
    静态加载
    <fragment
    android:id="@+id/fragment1"
    android:name="fragment"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
    动态加载
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(R.id.fragment1,new BlankFragment());
    transaction.commit();
    Fragment之间的通讯


    Fragment经常需要进行与其他的Fragment数据传递。


    Service


    Service是一个组件,总是运行在主线程中,通过startService()方法和bindService()方法来启动。




    WAMP


    WAMP集合了Apache+PHP+Mysql,哈哈。


    链接:https://pan.baidu.com/s/1qIu-4_0P4IaYMccbhLtrbw 密码:d5x2


  • 相关阅读:
    /etc/fstab 文件解释
    CRLF和LF
    Git远程操作详解
    jsp错误处理
    jsp隐式对象
    关于循环队列要注意的
    JSP动作元素
    JSP指令
    jsp语法简介
    jsp声明周期
  • 原文地址:https://www.cnblogs.com/dashucoding/p/11932699.html
Copyright © 2011-2022 走看看