关于Android中getLocalActivityManager
bodyView.removeAllViews();
View v = getLocalActivityManager().startActivity("one",
new Intent(MainActivity.this, OneView.class)).getDecorView();//生成view
//one ,two ,three , four 为activitygroup底部的四个功能菜单。
one.setBackgroundResource(R.drawable.frame_button_background);
two.setBackgroundResource(R.drawable.frame_button_nopressbg);
three.setBackgroundResource(R.drawable.frame_button_nopressbg);
four.setBackgroundResource(R.drawable.frame_button_nopressbg);
bodyView.addView(v);
removeAllviews 表示在显示该视图之前,先移除其他所有视图。
ActivityGroup的核心就是继承了该类,能够通过getLocalActivityManager()得到一个LocalActivityManager,LocalActivityManager通过startActivity(String id, Intent intent),可以与指定的Actiivty绑定,并且返回一个Window。
LocalActivityManager可以同时管理多个Activity
Window window1 = am.startActivity("Module1", newIntent(TestView.this, ModuleView1.class));
Window window2 = am.startActivity("Module2", newIntent(TestView.this, ModuleView2.class));
3.然后Window可以通过getDecorView()方法,返回一个View,然后通过与指定容器的addView(View)方法,实现不同的效果。
个人学习笔记。
一点江花月,一颗静水心。