多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > Android--頁面跳轉

Android--頁面跳轉

來源:程序員人生   發布時間:2015-03-11 08:40:08 閱讀次數:2856次

1.頁面1main.xml代碼以下:

<?xml version="1.0" encoding="utf⑻"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/layout1"/> <Button android:id="@+id/btn1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Go to Layout2" /> </LinearLayout>

頁面2mylayout.xml代碼以下:

<?xml version="1.0" encoding="utf⑻"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/text2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/layout2"/> <Button android:id="@+id/btn2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Go to Layout1" /> </LinearLayout>

2.java程序以下:

package org.lxh.demo; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Hello extends Activity { private Button btn1 = null; // private Button btn2=null; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 生命周期方法 super.setContentView(R.layout.main); // 設置要使用的布局管理器 this.btn1 = (Button) super.findViewById(R.id.btn1); btn1.setOnClickListener(new Button.OnClickListener() { public void onClick(View arg0) { jumpToLayout2(); } }); } public void jumpToLayout2() { setContentView(R.layout.mylayout); Button btn2 = (Button) super.findViewById(R.id.btn2); btn2.setOnClickListener(new Button.OnClickListener() { public void onClick(View arg0) { jumpToLayout1(); } }); } public void jumpToLayout1() { setContentView(R.layout.main); Button btn1 = (Button) super.findViewById(R.id.btn1); btn1.setOnClickListener(new Button.OnClickListener() { public void onClick(View arg0) { jumpToLayout2(); } }); } }

3.運行以下:


生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 日本中文字幕一区 | 国产综合区 | 欧美巨大video粗暴 | 中文字幕在线二区 | 香蕉免费网站 | 成人自拍在线 | 亚洲自拍偷拍区 | 中文字幕中韩乱码亚洲大片 | 综合九九 | 久久99精品久久久久久综合 | 久久精品影院一区二区三区 | 亚洲伊人久久大香线蕉在观 | 亚洲成人黄色在线观看 | 日本不卡在线播放 | 国产精品久久国产三级国不卡顿 | 免费国产成高清人在线视频 | 中文字幕日韩精品中文区 | 春色视频www免费视频观看 | 亚洲看| 中文字幕巨大乳在线看 | 日本一区二区三区免费视频 | 99热久久精品最新 | 曰本www | 精品国产爱久久 | 亚洲精品成人久久久影院 | 最近中文字幕视频完整 | 91福利一区二区在线观看 | 亚洲一区二区三区免费视频 | 久久久免费的精品 | 国产a毛片 | 性配久久久 | 国内精品免费视频精选在线观看 | 国产性夜夜春夜夜爽 | 欧美一级啪啪 | 成人精品在线视频 | 亚洲国产一区二区三区在线观看 | 亚洲欧美中文字幕高清在线一 | 亚洲综合二区 | 欧美色欧 | www插插插 | 手机看片高清日韩精品 |