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
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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>
    <!--底部功能菜单栏 -->
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/bottomlist"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.05">
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            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>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            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>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            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>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            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菜单的更多相关文章

  1. Android自定义控件----RadioGroup实现APP首页底部Tab的切换

    ​[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/ ...

  2. Android Studio精彩案例(二)《仿微信动态点击底部tab切换Fragment》

    转载本专栏文章,请注明出处,尊重原创 .文章博客地址:道龙的博客 现在很多的App要么顶部带有tab,要么就底部带有tab.用户通过点击tab从而切换不同的页面(大部分情况时去切换fragment). ...

  3. Android典型界面设计——FragmentTabHost+Fragment实现底部tab切换

    一.问题描述 在上次博文中,我们使用RadioGroup+ViewPage+Fragmen实现了顶部滑动导航(查看文章:http://www.cnblogs.com/jerehedu/p/460759 ...

  4. Ubuntu 14 添加Windows风格的底部任务栏

    习惯了Windows风格的底部任务栏,而Ubuntu 14是没有的,还好有人做好了一个任务栏插件,可以在线安装: 1.打开终端(Ctrl+Alt+T),然后输入下面的命令 sudo apt-get i ...

  5. 界面底部Tab实现

    现在基本上大部分的手机APP都要实现底部Tab,底部实现Tab的实现方式有很多种,那么有没有好的实现方式呢? 今天我将使用一个开源插件来实现底部Tab 参考自zhangli_的博客:http://bl ...

  6. Vue(小案例)底部tab栏和顶部title栏的实现

    ---恢复内容开始--- 一.前言 1.底部tab栏实现 2.顶部title栏实现 二.主要内容   1.底部tab栏实现(将底部导航提取到公共的组件中) 具体效果:当点击切换不同的tab的时候,对应 ...

  7. Xamarin.Forms 学习系列之底部tab

    App中一般都会有一个底部tab,用于切换不同的功能,在Xamarin中应该制作底部tab了,需要把Android的TabbedPage做一次渲染,IOS的则不用,接下来说下详细步骤: 1.在共享项目 ...

  8. 自定义 简单 底部tab

    项目地址:https://gitee.com/jielov/music-netease-api.git 先创建三个页面 分别为 home.vue , classify.vue, my.vue . 以下 ...

  9. 使用jQuery开发iOS风格的页面导航菜单

    在线演示1 本地下载     申请达人,去除赞助商链接 iOS风格的操作系统和导航方式现在越来越流行,在今天的jQuery教程中,我们将介绍如何生成一个iphone风格的菜单导航. HTML代码 我们 ...

随机推荐

  1. 一个Web页面的生命周期 ,面试常常被问到

    常规页生命周期阶段 一般来说,页要经历下表概述的各个阶段.除了页生命周期阶段以外,在请求前后还存在应用程序阶段,但是这些阶段并不特定于页.有关更多信息,请参见 ASP.NET 应用程序生命周期概述. ...

  2. bzoj 3594 [Scoi2014]方伯伯的玉米田(DP+二维BIT)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3594 [题意] 给定一个n个数的序列,有K次将一个区间内的数加1的机会,问最长不下降子 ...

  3. Ubuntu14.04LTS安装记录(办公室联想台式机)

    一.用UltraISO制作U盘启动器,被安装的电脑要设置成从U盘启动. 二.傻瓜式安装简体中文版 三.安装更新 sudo apt-get update sudo apt-get upgrade 四.安 ...

  4. 想要完全导入swc中的所有类

    其实还有个这个办法.修改参数.-include-libraries library [...] 强制导入SWC文件中的所有类,不管是否曾使用过这个类 (((比如把swc文件放到src里,然后编译参数加 ...

  5. create_project.py报错问题,建议用回python2.7

    d:\DevTool\cocos2d-x-2.2.2\cocos2d-x-2.2.2\tools\project-creator\create_project.py 报错 d:\DevTool\coc ...

  6. 【转】MySQL日期时间函数大全

    MySQL日期时间函数大全 1.DAYOFWEEK(date)  返回日期date是星期几(1=星期天,2=星期一,……7=星期六,ODBC标准)mysql> select DAYOFWEEK( ...

  7. JSF 2 link, commandLink and outputLink example

    In JSF, <h:link />, <h:commandLink /> and <h:outputLink /> tags are used to render ...

  8. Window服务初级教程以及log4net配置文件初始化

    Window服务初级教程:http://www.jb51.net/article/48987.htm 另外,配置log4net这个日志功能的时候需要初始化,不然会报没有初始化的错误,而且初始化的节点应 ...

  9. Keil MDK Code、RO-data、RW-data、ZI-data数据段

      Program Size: Code=10848 RO-data=780 RW-data=372 ZI-data=868   Code 表示程序代码指令部分 存放在Flash区 RO-data 表 ...

  10. 专门查看阻塞和死锁情况以及引起的SQL语句,你可以创建后,直接运行之。

    CREATE procedure sp_who_lock as begin declare @spid int declare @blk int declare @count int declare ...