<?xml version="1.0" encoding="utf-8"?><LinearLayout android:id="@+id/LinearLayout01"android:layout_width="fill_parent" android:layout_height="fill_parent"xmlns:android="http://schemas.android.com/apk/res/android"><Button android:layout_width="wrap_content"android:layout_height="wrap_content" android:id="@+id/Button11"android:text="Activity 1"></Button><Button android:layout_width="wrap_content"android:layout_height="wrap_content" android:id="@+id/Button12"android:text=" Activity 2   "></Button></LinearLayout>


<?xml version="1.0" encoding="utf-8"?><RelativeLayout android:id="@+id/RelativeLayout01"android:layout_width="fill_parent" android:layout_height="fill_parent"xmlns:android="http://schemas.android.com/apk/res/android"><TextView android:id="@+id/TextView01" android:layout_width="wrap_content"android:layout_height="wrap_content" android:background="#ffffff"android:text="Activity -- 1          "></TextView><RelativeLayout android:id="@+id/RelativeLayout02"android:layout_width="wrap_content" android:layout_height="wrap_content"android:layout_centerInParent="true"></RelativeLayout><com.farhan.masterLayout.Footerandroid:id="@+id/layoutFooter" android:layout_width="wrap_content"android:layout_height="wrap_content" android:layout_alignParentBottom="true" /></RelativeLayout>


public class Activity1 extends Activity {Footer footer;/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);footer = (Footer) findViewById(R.id.layoutFooter);footer.setActivity(this);}}


public class Footer extends LinearLayout {private Context mContext;private Button btn11;private Button btn12;// use Activity Object to call finish() method which is not possible using// contextprivate Activity mActivity;public Footer(Context context, AttributeSet attrs) {super(context, attrs);mContext = context;String infService = Context.LAYOUT_INFLATER_SERVICE;LayoutInflater li;li = (LayoutInflater) getContext().getSystemService(infService);li.inflate(R.layout.footer, this, true);btn11 = (Button) findViewById(R.id.Button11);btn11.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {Intent myIntent = new Intent(mContext, Activity1.class);mActivity.finish();mActivity.startActivity(myIntent);}});btn12 = (Button) findViewById(R.id.Button12);btn12.setOnClickListener(mFooterListener);}public void setActivity(Activity activity) {// set init otherwise of ctor and call externally...mActivity = activity;}// Create an anonymous implementation of OnClickListenerprivate OnClickListener mFooterListener = new OnClickListener() {public void onClick(View v) {Intent myIntent;switch (v.getId()) {case R.id.Button12:myIntent = new Intent(mContext, Activity2.class);mActivity.finish();mActivity.startActivity(myIntent);break;}}};}


Here its complete source code.http://www.megaupload.com/?d=QWCP60GN

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android界面布局开发使用的标签介绍
  2. android ScrollView边界阴影方法
  3. android 开发对gif解码(适配android 4.2、
  4. RealtiveLayout(相对布局属性)
  5. ListView 常用属性 详解
  6. Android(安卓)Studio apk系统签名和版本
  7. Android控件之EditText(输入文本框控件)
  8. android:installLocation简析
  9. Android(安卓)图书总汇
  10. Android(安卓)API中文文档EditText