前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >安卓入门教程(十五)- Fragment,Service,WAMP下载

安卓入门教程(十五)- Fragment,Service,WAMP下载

作者头像
达达前端
发布2022-04-29 09:14:40
2780
发布2022-04-29 09:14:40
举报
文章被收录于专栏:达达前端达达前端
Fragment概述

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

创建Fragment
代码语言:javascript
复制
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;
}
}
静态加载
代码语言:javascript
复制
<fragment
android:id="@+id/fragment1"
android:name="fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
动态加载
代码语言:javascript
复制
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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-03-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Fragment概述
  • 创建Fragment
  • 静态加载
  • 动态加载
  • Fragment之间的通讯
  • Service
  • WAMP
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档