Android开发实战记录
来源:互联网 发布:知柏地黄丸感冒能吃吗 编辑:程序博客网 时间:2024/06/07 11:03
摘记项目的一些片段来品味一下,都是一些值得背下来的基本用法
// i.putExtra("course",course); 则直接讲course对象小包序列化取出 course= getIntent().getParcelableExtra("course");
FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); if(planCate == 1){ tvLeft.setText(getString(R.string.plan_week_plan)); //直接把layout里的空白的FrameLayout给替换掉 // 考虑到week_plan和course_table的高度相似性 FgtPlanWeek weekPlanFragment = new FgtPlanWeek(); ft.replace(R.id.plan_content_frame,weekPlanFragment).commit(); } else if (planCate == 2){ tvLeft.setText(getString(R.string.plan_course_table)); FgtPlanCourseTable courseFragment = new FgtPlanCourseTable(); ft.replace(R.id.plan_content_frame,courseFragment).commit(); }
附上plan的layout和截图一张(可以看到基本是空白的)
<FrameLayout android:layout_width="fill_parent" android:layout_height="50dp"> <TextView android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@+id/plan_textview_left" android:layout_gravity="start" android:textSize="30sp" android:gravity="center_vertical"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_menu_delete" android:layout_gravity="end|center_vertical"/> </FrameLayout> <View android:layout_width="fill_parent" android:layout_height="1dp" android:background="#ffb0b0b0"/> <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/plan_content_frame"/>
@Override public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { TextView myText; if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.plan_child, parent, false); } myText = (TextView) convertView.findViewById(R.id.plan_child_text); lesson = getChild(groupPosition, childPosition); myText.setText(lesson.getTitle()); ImageView iv = (ImageView) convertView.findViewById(R.id.plan_child_indicator); if (lesson.isLearned()) { iv.setImageResource(R.drawable.lesson_completed); } else { iv.setImageResource(R.drawable.lesson_uncompleted); } loadingButton = (LoadingButton) convertView.findViewById(R.id.plan_child_load_video); """ //when scroll ListView the ChildView will reuse/create/destroy ,so we need bind AtyPlan.setLoadingButton(loadingButton, course, lesson, context); //这个方法将按钮、按钮对应的课程进行绑定 return convertView;""" }
3、关于DrawerLayout的使用
DrawerLayout是android自带的抽屉控件,可实现抽屉的效果,但确实直接覆盖在主界面上的,其实最好的抽屉效果应该是像手机QQ那样有一个拉开的效果的(猜测是需要继承Drawerlayout再重写一些方法),具体的不同朋友们可以试试手机QQ和知乎的主页面的不同就知道了,具体的实现效果Google一下吧~~
0 0
- Android开发实战记录
- Android开发实战记录(三)---HelloWorld
- 《Android应用开发实战(第二版)》学习记录
- Android开发实战记录(二)-Android开发环境搭建之Windows-正式配置环境
- 实战Android应用开发
- Android NFC开发实战
- Android开发----实战项目
- Android AppWidget开发实战
- Android 开发实战
- Android开发规范实战
- Android 开发实战经验总结
- Android 开发实战经验总结
- Android 开发实战经验总结
- Android 开发实战经验总结
- Android相机开发实战
- Android 开发实战经验总结
- Android开发实战经验
- Android开发实战经验总结
- struts (三)
- 自定义分节seekBar,类似stepView效果
- 使用canvas与Paint在View中居中绘制文字
- iOS设计模式-单例
- Android Studio 快捷键
- Android开发实战记录
- 黑马程序员------反射
- 通过Servlet生成验证码图片
- 用P3P header解决iframe跨域访问cookie
- jni 简单实践 eclipse支持c++11
- 【VR】Leap Motion 官网文档 FingerModel (手指模型)
- python 多线程两种实现方式
- 虚拟机安装ubuntu出现的问题。
- 理解Java对象序列化