- 浏览: 266990 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
androidios2014:
运行有滚没有把分组选项置顶,楼主帮忙给个源码学习7196628 ...
【so easy~】完全仿QQ好友列表,自定义ExpandableListView! -
hnu_hgc:
求代码,3243544018@qq.com
Android释放内存(结束进程) -
hnu_hgc:
求代码工程
Android释放内存(结束进程) -
l657757077:
楼主给个源码学习学习。邮箱:657757077@qq.com
【so easy~】完全仿QQ好友列表,自定义ExpandableListView! -
hao_yh:
楼主,修改后的代码能发我一份吗?感谢。感觉现在是只要界面创建就 ...
【so easy~】完全仿QQ好友列表,自定义ExpandableListView!
java代码
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); } }
xml布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:orientation="vertical" android:layout_height="fill_parent"> <!--动态显示界面--> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/bodyL" 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:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@+id/home" 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:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@+id/gamebox" 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:orientation="vertical" android:layout_width="wrap_content" android:id="@+id/team" 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:orientation="vertical" android:layout_width="wrap_content" android:id="@+id/more" 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>
发表评论
-
【so easy】Android手动打包流程,完全详细版!
2012-08-09 12:19 5164由于是先写的word文档,所以排版不好,看不清的朋友可以直 ... -
转:Bitmap造成OOM的讨论与解决方案
2012-07-26 16:08 11136android BitmapFactory的OutOfM ... -
【so easy~】自定义上下menu菜单
2012-06-25 18:14 2346最近做了自定义菜单,许多阅读器的样子,都是点击屏幕中央弹 ... -
【so easy】Tabhost每个tab中放入多个Activity!
2012-04-25 18:14 5041最近做完了一个客户端项目 外面是个tabhost(用于底部t ... -
【so easy~】完全退出
2012-03-08 16:52 1674String packagename = getPac ... -
【BUG解决】WebView cookies清理
2012-03-05 15:21 12015今天在项目中发现一个BUG 在使用新浪微博账户登录应用时,w ... -
Project has no default.properties file! Edit the project properties to set one.
2012-02-20 14:02 1835导入新项目 有时会:Project has no def ... -
【so easy~】完全仿QQ好友列表,自定义ExpandableListView!
2012-01-10 16:14 24879最近,需要做一个可展开的listview,不禁想起了Expan ... -
Android释放内存(结束进程)
2011-12-30 15:45 10122这两天在搞个内存清理小插件,网上很少这方面资料,之前找过清 ... -
【so easy~】 Gallery 模仿Flash广告栏~!附源码
2011-12-19 16:24 5562先上个效果图~ http://androiddada.i ... -
android 获得手机信息
2011-12-02 14:22 1330Android中与电话功能相关的类是 Telephony ... -
【so easy~】 Webview离线功能(优先cache缓存+cache缓存管理)!
2011-11-28 17:05 39623在做Webview显示服务器的html功能时 需要加入离线功能 ... -
转!SQL:char、varchar、text和nchar、nvarchar、ntext的区别
2011-11-21 16:07 1731SQL:char、varchar、text和nchar、n ... -
【so easy~】 底部菜单可移动焦点~!(仿网易新闻等应用)
2011-11-18 10:51 3570最近比较懒惰,也没有更新博客。今天就把刚刚实现的一个小效果分享 ... -
转:shape 渐变!描边!圆角!漂亮的自定义背景
2011-11-09 09:47 3903在实现背景渐变的帖子里 http://androi ... -
ListView item渐变背景(ListView必备!)
2011-11-07 15:32 7082在看他人的代码学习时,无意中发现的。很多应用中的ListVi ... -
Android之系统自带的文字外观设置及实际显示效果图
2011-11-07 14:50 1250Android之系统自带的文字外观设置及实际显示效果图 ... -
【so easy~】 Intent实现 <分享>功能!~
2011-10-31 15:06 1491http://androiddada.iteye.com/ ... -
【so easy~】 GPS的那点儿事儿~!
2011-10-28 14:27 1981http://androiddada.iteye.com/ ... -
Service使用总结 与sdk部分翻译
2011-10-27 15:12 16331. Service SDK翻译 ...
相关推荐
使用GridView+ActivityGroup实现的tab分页效果
ActivityGroupTest ActivityGroup 实现Tab分页
activitygroup底部菜单切换
基于GridView和ActivityGroup实现的Tab分页
Gallery+ActivityGroup实现滑动tab独立的Activity
ActivityGroup|顶部底部均有Tab标签之二 http://blog.csdn.net/geofferysun/article/details/41852605
用ActivityGroup实现的activity栈,类似IOS的UINavigationController
ActivityGroup + GridView 实现Tab分页标签
ActivityGroup 使用实现tab分页标签,保存Activity状态、使用子Activity的Menu
借助ActivityGroup可以嵌套Activity的功能来实现Tab功能。 http://blog.csdn.net/xyz_lmn/article/details/6939160
用ActivityGroup+GridView实现Tab分页标签,并且可以滑动切换页面
TabHost限制较多,自己定制不容易使用。本例子继承于ActivityGroup实现与TabHost类似的效果。其中的还实现了按钮的触发状态切换效果。代码详细易懂!上传共同学习,有不好的请指出。。谢谢!
自定义菜单布局+ActivityGroup+多个Activity的方式实现仿新浪微博底部菜单更新UI) 详解:http://blog.csdn.net/pocoyoshamoo/article/details/24708715
很多客户端软件和浏览器软件都喜欢用Tab分页标签来搭建界面框架。读者也许会马上想到使用TabHost 与 TabActivity的组合,其实最常用的不是它们,而是由GridView与ActivityGroup的组合。每当用户在GridView选中一项,...
ActivityGroup和GridView实现标签分页 ActivityGroup和GridView实现标签分页
在Android程序中很多客户端软件和浏览器软件都喜欢用Tab分页标签来搭建界面框架。读者也许会马上想到使用TabHost 与 TabActivity的组合,其实最常用的不是它们,而是由GridView与ActivityGroup的组合。每当用户在...
GridView+ActivityGroup 实现Tab分页
今天为大家介绍下使用GridView和ActivityGroup实现的分页,这里需要将Activity转换成Window,然后再换成成View添加到容器中,具体实现代码如下,感兴趣的朋友可以参考下哈
效果图看上一版本http://www.apkbus.com/android-116690-1-1.html,上一版本是利用activitygroup实现底部菜单切换,基于现在都不太赞同用,于是简单地利用fragment 来实现了这一效果,IndexActivity为底部菜单的首页...
ActivityGroup的用法,头部和底部为固定布局中间动态显示界面 并在中间布局实现手势滑动效果,自定义SlidingDrawer(抽屉)效果,在ActivityGroup里执行跳转等功能。至于在Android在ActivityGroup里执行跳转详细介绍 ...