看慕课网节日短信祝福UI自我总结实现过程
2016-03-24 20:11
477 查看
1,数据类:
1,Festival:id,name
2,Msg:id,festivalId,content
3,FestivalLab:List<Festival>mFestivals,List<Msg>mMsgs --------自己组建的数据库1、mFestivals.add()、mMsgs.add() 添加数据
2、getFestivalById()、getMsgById()
2,编写MainActivity
1,Indicator.setViewPager()绑定ViewPager
2,ViewPager.setAdapter()绑定FragmentPagerAdapter
3,FragmentPagerAdapter返回自定义的FestivalCategoryFragment
3,编写FestivalCategoryFragment(一个GridView)
1,mInflater=LayoutInflater.from(this)初始化 mInflater
2,在onCreateView中setContentView()采用GridView布局
3,在onViewCreated中加载GridView,为GridView.setAdapter,绑定List<Festival>数据,动态添加TextView
4,GridView.setOnItemClickListener,利用intent将FestivalId传去并打开chooseActivity
4,编写chooseActivity(一个ListView)
得到了FestivalId
1,在[b]onCreate中setContentView()采用ListView布局[/b]
[b] 2,在ListView中setAdapter(),重写ArrayAdapter中getView()方法[/b]
[b]setAdater(mAdapter=new ArrayAdapter(this,-1,数据){[/b]
[b]if(convertView==null)[/b]
[b]convertView=mInflater.inflate(布局,parent,false);[/b]
}[b]);[/b]
得到了convertView为ListView布局的View,通过findViewById,set各种回显数据
为每个btn.setOnClickListener,跳转去sendActivity
return convertView;
5,编写sendActivity(一个EditText,btn)
1,在onCreate中加载View,getIntent()得到传入的数据,用封装的数据保存
2,定义一个静态toActivity(Content content,Festival festivalId,Msg msgId)方法
这样可以利用intent传入festivalId与msgId
Intent intent =new Intent(context,SendMsgActivity.class); intent.putExtra(KEY_FESTIVAL_ID,festivalId); intent.putExtra(KEY_MSG_ID, msgId); context.startActivity(intent);
相关文章推荐
- 【UVA11538】Chess Queen——简单组合
- UIKit框架各个类的简介
- DuiLib介绍及其消息处理剖析
- Can you answer these queries?(线段树)
- codeforces 597C C. Subsequences(dp+树状数组)
- LeetCode: Longest Consecutive Sequence [128]
- Castle Windsor Fluent Registration API
- collection系列用法-deque双向队列
- android学习——res/values/contentDescription报错
- juery中循环遍历json数组
- UIKeyboardTypeNumberPad 数字键盘自定义按键
- 来段代码提提神-Java读取config.properties文件中的key=value
- requirejs模块化框架用法分享
- request.getparam()与request.getAttibute()的区别
- 获取 当前显示的 UIViewController
- 在Android studio中进行单元测试和ui测试
- WM_CLOSE、WM_DESTROY、WM_QUIT学习总结(点击关闭按钮会触发WM_CLOSE消息,DestroyWindow API会触发WM_DESTROY和WM_NCDESTROY消息,MSDN上写的很清楚)
- hierarchy viewer不能获取userbuild手机版本的UI布局
- UIAutomator遇到的坑
- 聊聊并发(六)ConcurrentLinkedQueue的实现原理分析