ActivityGroup+LinearLayout实现iphone风格的底部tab菜单
public class ActsGroup extends ActivityGroup { private LinearLayout bodyView; private LinearLayout home, gamebox, team, more; private int flag = 0; // 通过标记跳转不同的页面,显示不同的菜单项 // private String parameter = Constant.BUTTON_HOME;// 初始化加载 /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); // 无标题 super.onCreate(savedInstanceState); setContentView(R.layout.acts_group); initMainView(); // 主界面开始接收参数 Bundle bundle = getIntent().getExtras(); if (null != bundle) { flag = bundle.getInt("flag"); } // 默认显示 showView(flag); home.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub flag = 0; showView(flag); } }); gamebox.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub flag = 1; showView(flag); } }); team.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub flag = 2; showView(flag); } }); more.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub flag = 3; showView(flag); } }); } /* * 初始化主界面底部的功能菜单 */ public void initMainView() { bodyView = (LinearLayout) findViewById(R.id.bodyL); home = (LinearLayout) findViewById(R.id.home); gamebox = (LinearLayout) findViewById(R.id.gamebox); team = (LinearLayout) findViewById(R.id.team); more = (LinearLayout) findViewById(R.id.more); } // 在主界面中显示其他界面 public void showView(int flag) { switch (flag) { case 0: showHome(); break; case 1: showGamebox(); break; case 2: showTeam(); break; case 3: showMore(); break; default: break; } } public void showHome() { bodyView.removeAllViews(); bodyView.addView(getLocalActivityManager().startActivity("home", new Intent(ActsGroup.this, MainActivity.class)).getDecorView()); home.setBackgroundResource(R.drawable.tab_highlight); gamebox.setBackgroundResource(R.drawable.tab_background); more.setBackgroundResource(R.drawable.tab_background); team.setBackgroundResource(R.drawable.tab_background); } public void showGamebox() { bodyView.removeAllViews(); bodyView.addView(getLocalActivityManager().startActivity("gamebox", new Intent(ActsGroup.this, Menu2Activity.class)).getDecorView()); gamebox.setBackgroundResource(R.drawable.tab_highlight); home.setBackgroundResource(R.drawable.tab_background); more.setBackgroundResource(R.drawable.tab_background); team.setBackgroundResource(R.drawable.tab_background); } public void showTeam() { bodyView.removeAllViews(); bodyView.addView(getLocalActivityManager().startActivity("team", new Intent(ActsGroup.this, Menu2Activity.class)).getDecorView()); team.setBackgroundResource(R.drawable.tab_highlight); home.setBackgroundResource(R.drawable.tab_background); more.setBackgroundResource(R.drawable.tab_background); gamebox.setBackgroundResource(R.drawable.tab_background); } public void showMore() { bodyView.removeAllViews(); bodyView.addView(getLocalActivityManager().startActivity("more", new Intent(ActsGroup.this, Menu2Activity.class)).getDecorView()); more.setBackgroundResource(R.drawable.tab_highlight); home.setBackgroundResource(R.drawable.tab_background); team.setBackgroundResource(R.drawable.tab_background); gamebox.setBackgroundResource(R.drawable.tab_background); }}|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!--动态显示界面 --> <LinearLayout android:id="@+id/bodyL" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.95"> </LinearLayout> <!--底部功能菜单栏 --> android:id="@+id/bottomlist" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0.05"> android:id="@+id/home" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="5" android:gravity="center_horizontal"> <ImageView android:background="@drawable/home" android:layout_gravity="top|center" android:layout_height="35dp" android:layout_width="32dp" android:layout_marginTop="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="20dp" android:text="@string/home" /> </LinearLayout> android:id="@+id/gamebox" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="5" android:gravity="center_horizontal"> <ImageView android:background="@drawable/gamebox" android:layout_gravity="top|center" android:layout_height="35dp" android:layout_width="32dp" android:layout_marginTop="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="20dp" android:text="@string/gamebox" /> </LinearLayout> android:id="@+id/team" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="5" android:gravity="center_horizontal"> <ImageView android:background="@drawable/team" android:layout_gravity="top|center" android:layout_height="35dp" android:layout_width="32dp" android:layout_marginTop="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="20dp" android:text="@string/team" /> </LinearLayout> android:id="@+id/more" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="5" android:gravity="center_horizontal"> <ImageView android:background="@drawable/more" android:layout_gravity="top|center" android:layout_height="35dp" android:layout_width="32dp" android:layout_marginTop="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="20dp" android:text="@string/more" /> </LinearLayout> </LinearLayout></LinearLayout> |
ActivityGroup+LinearLayout实现iphone风格的底部tab菜单的更多相关文章
- Android自定义控件----RadioGroup实现APP首页底部Tab的切换
[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/ ...
- Android Studio精彩案例(二)《仿微信动态点击底部tab切换Fragment》
转载本专栏文章,请注明出处,尊重原创 .文章博客地址:道龙的博客 现在很多的App要么顶部带有tab,要么就底部带有tab.用户通过点击tab从而切换不同的页面(大部分情况时去切换fragment). ...
- Android典型界面设计——FragmentTabHost+Fragment实现底部tab切换
一.问题描述 在上次博文中,我们使用RadioGroup+ViewPage+Fragmen实现了顶部滑动导航(查看文章:http://www.cnblogs.com/jerehedu/p/460759 ...
- Ubuntu 14 添加Windows风格的底部任务栏
习惯了Windows风格的底部任务栏,而Ubuntu 14是没有的,还好有人做好了一个任务栏插件,可以在线安装: 1.打开终端(Ctrl+Alt+T),然后输入下面的命令 sudo apt-get i ...
- 界面底部Tab实现
现在基本上大部分的手机APP都要实现底部Tab,底部实现Tab的实现方式有很多种,那么有没有好的实现方式呢? 今天我将使用一个开源插件来实现底部Tab 参考自zhangli_的博客:http://bl ...
- Vue(小案例)底部tab栏和顶部title栏的实现
---恢复内容开始--- 一.前言 1.底部tab栏实现 2.顶部title栏实现 二.主要内容 1.底部tab栏实现(将底部导航提取到公共的组件中) 具体效果:当点击切换不同的tab的时候,对应 ...
- Xamarin.Forms 学习系列之底部tab
App中一般都会有一个底部tab,用于切换不同的功能,在Xamarin中应该制作底部tab了,需要把Android的TabbedPage做一次渲染,IOS的则不用,接下来说下详细步骤: 1.在共享项目 ...
- 自定义 简单 底部tab
项目地址:https://gitee.com/jielov/music-netease-api.git 先创建三个页面 分别为 home.vue , classify.vue, my.vue . 以下 ...
- 使用jQuery开发iOS风格的页面导航菜单
在线演示1 本地下载 申请达人,去除赞助商链接 iOS风格的操作系统和导航方式现在越来越流行,在今天的jQuery教程中,我们将介绍如何生成一个iphone风格的菜单导航. HTML代码 我们 ...
随机推荐
- MapReduce 中job.setJarByClass()方法的疑惑
在调试mr实例的时候,遇到如下的情况,如图所示 说明:就是我的mr程序类名称和我设置的setJarByclass()中设置的不一样,但是程序竟然没有报错!!!!当时把我吓尿了 疑惑:如果这样设置的话, ...
- vim中编码方式---不完整总结
关于编码,总有很多故事,这里只是记录下暂时的东西. 1.关于查看文件的编码 在查看文件编码的时候,总是倾向于使用file来进行查看,然而使用file命令的时候,并没有什么卵用: 在查看细节的时候,可以 ...
- storm流式大数据处理流行吗
在如今这个信息高速增长的今天,信息实时计算处理能力已经是一项专业技能了,正是因为有了这些需求的存在才使得分布式,同时具备高容错的实时计算系统Storm才变得如此受欢迎,为什么这么说呢?下面看看新霸哥的 ...
- linux c多线程编程范例
#include <stdio.h> #include <pthread.h> #include <unistd.h> #include <stdlib.h& ...
- jboss服务器配置多实例
jboss配置多实例的重要性 在开发, 测试项目的过程中, 我们经常需要在同一台主机上, 同一个服务器上配置多个运行实例.这样做有一下几点好处: 在项目开发, 调试阶段能最大限度的节省资源 某个实例出 ...
- 快速入门linux系统的iptables防火墙 1 本机与外界的基本通信管理
概述 iptables是一种运行在linux下的防火墙组件,下面的介绍可以快速的学习iptables的入门使用. 特点(重要) 它的工作逻辑分为 链.表.规则三层结构. 数据包通过的时候,在对应表中, ...
- linux命令 screen的简单使用
在远程命令行下某些长时间的操作,一旦网络出现故障,后果可能会很严重,在这种情况下可以使用screen命令来解决.screen可以创建一个session,在不小心断开以后还可以继续恢复session保存 ...
- 关于 python 的 @property总结和思考
其实关于@property我到处去搜了很多教程来看,因为公司大量使用了oop的编程而我以前很少写,所以现在来重新补过来. 从使用上来说 加了@property之后最明显的区别就是 class Stud ...
- JVM系列二:GC策略&内存申请、对象衰老
JVM里的GC(Garbage Collection)的算法有很多种,如标记清除收集器,压缩收集器,分代收集器等等,详见HotSpot VM GC 的种类 现在比较常用的是分代收集(generatio ...
- ACM 数论小结 2014-08-27 20:36 43人阅读 评论(0) 收藏
断断续续的学习数论已经有一段时间了,学得也很杂,现在进行一些简单的回顾和总结. 学过的东西不能忘啊... 1.本原勾股数: 概念:一个三元组(a,b,c),其中a,b,c没有公因数而且满足:a^2+b ...