MyFlag Step11 :menupath的移植工作
来源:互联网 发布:租用临时备案域名 编辑:程序博客网 时间:2024/06/06 01:46
引言
本周的计划相对稳定,就是继续前一段时间我们的工作,整体的计划具体如下:
- 客户端 :修改密码和查看个人信息
- 后台:SuperviseDao的功能实现
- 界面:界面跳转关系与布局的优化
现在对于界面的优化,具体的工作如下:
界面移植
- 首先是将res文件夹下drawable下的图片文件复制到myflag相应的地方。
- 将layout下的布局文件 sat_item_cr.xml、sat_main.xml移入myflag相应文件夹下
- 拷贝values文件夹下的 sat_attrs.xml、sat_strings.xml文件
同时拷贝以下文件进入对应文件夹
在项目文件的java目录下新建文件夹menupath并响应文件拷贝
下面的部分也是最主要的部分也是最困难的部分,将控件叠加在主界面上而且不影响主界面工作
acticity_main.xml文件:
<?xml version="1.0" encoding="utf-8"?><carbon.widget.LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:sat="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/activity_bg_gray" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <com.example.sdu.myflag.widget.CustomViewPager android:id="@+id/main_view_pager" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/activity_bg_gray" tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp"> </com.example.sdu.myflag.widget.CustomViewPager> <com.example.sdu.myflag.menupath.SatelliteMenu android:id="@+id/menu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|left" android:layout_margin="8dp" sat:satelliteDistance="100dp" sat:mainImage="@drawable/ic_launcher" sat:totalSpacingDegree="90" sat:closeOnClick="true" sat:expandDuration="500" tools:layout_editor_absoluteX="0dp" android:layout_alignParentBottom="true" tools:layout_editor_absoluteY="444dp"> </com.example.sdu.myflag.menupath.SatelliteMenu> </RelativeLayout> <carbon.widget.LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" android:orientation="horizontal" tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp"> <carbon.widget.LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:onClick="onMainTabClick" android:orientation="vertical"> <ImageView android:id="@+id/tab_main_img" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/main_page_default" /> <TextView android:id="@+id/tab_main_tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4dp" android:text="首页" android:textColor="@color/tab_text_color_gray" android:textSize="14sp" /> </carbon.widget.LinearLayout> <carbon.widget.LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:onClick="onCommunityTabClick" android:orientation="vertical"> <ImageView android:id="@+id/tab_community_img" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/community_default" /> <TextView android:id="@+id/tab_community_tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4dp" android:text="社区" android:textColor="@color/tab_text_color_gray" android:textSize="14sp" /> </carbon.widget.LinearLayout> <carbon.widget.LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:onClick="onMySelfTabClick" android:orientation="vertical"> <ImageView android:id="@+id/tab_myself_img" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/myself_default" /> <TextView android:id="@+id/tab_myself_tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4dp" android:text="我" android:textColor="@color/tab_text_color_gray" android:textSize="14sp" /> </carbon.widget.LinearLayout> </carbon.widget.LinearLayout></carbon.widget.LinearLayout>
其中主要用了layout_alignParentBottom这一特性;它是将控件作为一个控件的子控件并显示在其底部
7、相应的java文件中,对main_activity.java的修改如下:
在initView方法下创建菜单:
SatelliteMenu menu = (SatelliteMenu) findViewById(R.id.menu); List<SatelliteMenuItem> items = new ArrayList<SatelliteMenuItem>(); items.add(new SatelliteMenuItem(4, R.drawable.ic_1)); items.add(new SatelliteMenuItem(4, R.drawable.ic_3)); //items.add(new SatelliteMenuItem(4, R.drawable.ic_4)); //items.add(new SatelliteMenuItem(3, R.drawable.ic_5)); //items.add(new SatelliteMenuItem(2, R.drawable.ic_6)); items.add(new SatelliteMenuItem(1, R.drawable.ic_2)); menu.addItems(items);
添加监听器:
menu.setOnItemClickedListener(new SatelliteMenu.SateliteClickedListener() { public void eventOccured(int id) { Log.i("sat", "Clicked on " + id); } });
到此为止,我们的界面移植过程就顺利结束了。
现在看下效果图:
总结
这样看新的菜单空间的假如似乎破坏了整个界面的美观性,但是这才是初步的优化,菜单键的加入是本着对于频繁的操作减少用户达到目的的中间过程。后期还会继续优化。
阅读全文
0 0
- MyFlag Step11 :menupath的移植工作
- MyFlag Step12:menupath界面跳转测试以及其他优化
- MyFlag Step11:后台代码编写与客户端具体功能实现以及界面优化
- MyFlag Step11:后台代码编写、客户端具体功能实现与界面优化
- myflag step10:flagdao的编写
- myflag step13:接口的完成
- 系统移植---移植涉及的工作
- 移植android的工作环境
- uboot移植之前的工作
- MyFlag Step6:好友信息的处理
- myflag step7 增加friend的支持
- myflag step8:新增user的支持
- myflag step9:新增falg的支持
- MyFlag Step 9:Flag相关的功能设计
- MyFlag Step9 :Flag功能相关的设计
- MyFlag Step13:打卡功能的初步讨论
- MyFlag Step14: 打卡功能界面的初步
- 一个软件移植工作的总结
- Ubuntu14.04上安装ROS
- 后端框架_数据库技术mysql
- HashSet哈希值
- 字符数组、String类、StringBuffer三者的相互转换
- SpringMVC之浅析上下文初始化(二)
- MyFlag Step11 :menupath的移植工作
- java中的乱码及编码问题
- 有两个顺序表LA,LB,其元素均为非递减有序排列,编写算法将它们合并成一个顺序表LC,要求LC也是非递减有序排列。
- 【Unity优化】内存优化
- Python基础(四)- 函数
- Rxjava学习笔记-01
- 需求调研该怎么做
- 链表的简单实现
- 前端开发框架文档