WEB开发网
开发学院手机开发Android 开发 Android 使用 ActivityGroup 来切换 Activity 和 ... 阅读

Android 使用 ActivityGroup 来切换 Activity 和 Layout

 2010-11-05 00:56:35 来源:WEB开发网   
核心提示:39. mScroll.removeAllViews();40. mScroll.addView(mActivityManager.startActivity("",41. new Intent(this, ActivityTest1.class)).getDecorView());42. brea

39. mScroll.removeAllViews();

40. mScroll.addView(mActivityManager.startActivity("",

41. new Intent(this, ActivityTest1.class)).getDecorView());

42. break;

43. case R.id.btnModule2:

44. mScroll.removeAllViews();

45. mScroll.addView(mActivityManager.startActivity("",

46. new Intent(this, ActivityTest2.class)).getDecorView());

47. break;

48. case R.id.btnModule3:

49. break;

50. }

51. }

52. }

package com.ffly.demo;

import android.app.ActivityGroup;

import android.app.LocalActivityManager;

import android.content.Intent;

import android.os.Bundle;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.ImageView;

import android.widget.ScrollView;

public class MainActivity extends ActivityGroup implements OnClickListener {

private ScrollView mScroll = null;

private ImageView mImgBtn1 = null;

private ImageView mImgBtn2 = null;

private ImageView mImgBtn3 = null;

private LocalActivityManager mActivityManager = null;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

mScroll = (ScrollView) findViewById(R.id.containerBody);

mImgBtn1 = (ImageView) findViewById(R.id.btnModule1);

mImgBtn2 = (ImageView) findViewById(R.id.btnModule2);

mImgBtn3 = (ImageView) findViewById(R.id.btnModule3);

mImgBtn1.setOnClickListener(this);

mImgBtn2.setOnClickListener(this);

mImgBtn3.setOnClickListener(this);

mActivityManager = getLocalActivityManager();

}

@Override

public void onClick(View v) {

上一页  1 2 3 4 5  下一页

Tags:Android 使用 ActivityGroup

编辑录入:coldstar [复制链接] [打 印]
赞助商链接