android 頁面轉換

通過setContentView來改變布局

很簡單

ViewchangeActivity.java

package idrc.change;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class ViewchangeActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button m_Button01=(Button)findViewById(R.id.button01);
m_Button01.setOnClickListener(new Button.OnClickListener()
{

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
jumpTolayout2();
}

}
);
}
//跳轉到第二個布局
public void jumpTolayout2()
{
setContentView(R.layout.mylayout);
Button m_Button02=(Button)findViewById(R.id.button02);
m_Button02.setOnClickListener(new Button.OnClickListener()
{

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
jumpTolayout1();
}

}
);
}
//跳轉到第一個布局
public void jumpTolayout1()
{
setContentView(R.layout.main);
Button m_Button01=(Button)findViewById(R.id.button01);
m_Button01.setOnClickListener(new Button.OnClickListener()
{

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
jumpTolayout2();
}

}
);
}
}

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="vertical" ><TextViewandroid:id="@+id/textview01"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="#00aa00"android:text="@string/layout01" /><Buttonandroid:id="@+id/button01"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="#0000aa"android:text="go to layout2" />
</LinearLayout>

mylayout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:background="#FFFFFFFF"android:orientation="vertical" ><TextViewandroid:id="@+id/textview02"android:layout_width="fill_parent"android:layout_height="wrap_content"android:text="@string/layout02" /><Buttonandroid:id="@+id/button02"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="go to layout1"/></LinearLayout>

  


?

轉載于:https://www.cnblogs.com/shanshan520/archive/2012/01/08/2316358.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/379998.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/379998.shtml
英文地址,請注明出處:http://en.pswp.cn/news/379998.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

mts模式_MTS的完整形式是什么?

mts模式MTS&#xff1a;Microsoft Transaction Server /移動電話服務/多通道電視聲音 (MTS: Microsoft Transaction Server/ Mobile Telephone Service/ Multichannel Television Sound) 1)MTS&#xff1a;Microsoft Transaction Server (1) MTS: Microsoft Transaction Server…

Java——IO流

一&#xff0c;IO流常識 Ⅰ&#xff0c;IO流的概述 1&#xff0c;IO流用來處理設備之間的數據傳輸 2&#xff0c;Java對數據的操作都是通過流的方式 3&#xff0c;Java用于操作流的類都在IO包中 4&#xff0c;流 按流向分為&#xff1a; ①輸入流 ②輸出流 5&#xff0…

JBE、JNBE、JA、JL指令詳解(從原理上)

JBE 當執行到JBE命令時&#xff0c;如果此時的CF標志位或者ZF標志位為1&#xff0c;跳轉&#xff0c;其他不跳轉 相當于小于等于命令 cmp eax&#xff0c;ecx jbe 0040100c執行到cmp命令時&#xff0c;如果此時的eac小于等于ecx&#xff0c;jbe都會跳轉到0040100c 因為小于的…

數組shift方法_數組shift()方法以及JavaScript中的示例

數組shift方法JavaScript shift()方法 (JavaScript shift() method) shift() method is used to remove the first element of an array and returns the deleted element. shift()方法用于刪除數組的第一個元素&#xff0c;并返回刪除的元素。 It changes the array length. …

ArcMap 9使用技巧

ArcMap 9使用技巧技巧1 重疊要素的選擇切換目標&#xff1a;在覆蓋同一區域的多個要素中切換被選擇要素操作步驟&#xff1a;1&#xff0e;在編輯環境中選中覆蓋同一區域的多個要素中的一個要素2&#xff0e;按下N 鍵&#xff0c;被選要素就會自動地切換到另一個圖層的要素3&am…

《軟件》2011年第6期刊登出 《DB 查詢分析器》中斷SQL語句的執行

《軟件》編輯部寄來了2011年第6期樣刊&#xff0c;在2011年第6期&#xff0c;刊登出了本人的論文------“《DB 查詢分析器》中斷SQL語句的執行”。 論文刊登在第42頁&#xff0c;排在第13篇&#xff0c;還比較靠前&#xff0c;呵呵。 在“萬方數據”和“中國期刊全文數據庫”中…

Java——IO流(序列流)

序列化與反序列化 游戲存檔&#xff1a;目的是為了游戲下次上號數據的保存 package com.yy.otherio;import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; im…

ret2libc過地址隨機化

程序&#xff1a; #include<stdio.h> char buf2[10] "this is buf2"; void vul() {char buf1[10];gets(buf1); } void main() {write(1,"sinxx",5);vul(); }很明顯&#xff0c;gets函數存在溢出 編譯&#xff1a; gcc -no-pie -fno-stack-protect…

[導入]Lucene并發訪問

作者: yagesi 鏈接&#xff1a;http://yagesi.javaeye.com/blog/165604 發表時間: 2008年02月27日 聲明&#xff1a;本文系JavaEye網站發布的原創博客文章&#xff0c;未經作者書面許可&#xff0c;嚴禁任何網站轉載本文&#xff0c;否則必將追究法律責任&#xff01; 在Luce…

Python程序計算給定文本中單詞的出現

Given a text (paragraph) and a word whose occurrence to be found in the text/paragraph, we have to find the how many times word is repeated in the text. 給定一個文本 (段落)&#xff0c;其出現在文本/段落被找到的單詞 &#xff0c;我們必須找到如何詞多次在文本重…

js私有共有成員

在小項目中對于JavaScript使用&#xff0c;只要寫幾個function就行了。但在大型項目中&#xff0c;尤其是在開發追求 良好的用戶體驗的網站中&#xff0c;如SNS,就會 用到大量的JavaScrpt&#xff0c;有時JavaScript的工作量勝過了C#&#xff0c;這時寫一堆function,就會顯得很…

Java——IO(打印流)

1&#xff0c;打印字節流(PrintStream)的概述&#xff1a; 打印流可以很方便的將對象的toString()結果輸出并且自動加上換行&#xff0c;而且可以使用自動刷出的模式 System.out就是一個PrintStream&#xff0c;其默認向控制臺輸出信息 2&#xff0c;使用方式&#xff1a; …

MATLAB中的正態分布檢驗

要對一組樣本進行正態性檢驗&#xff0c;在MATLAB中&#xff0c;一種方法是用normplot畫出樣本&#xff0c;如果都分布在一條直線上&#xff0c;則表明樣本來自正態分布&#xff0c;否則是非正態分布。 MATLAB中也提供了幾種更正式的檢驗方法&#xff1a;kstest Kolmogorov-Smi…

遠控免殺專題(29)-C#加載shellcode免殺-5種方式(VT免殺率8-70)

0x00 免殺能力一覽表 幾點說明&#xff1a; 1、表中標識 √ 說明相應殺毒軟件未檢測出病毒&#xff0c;也就是代表了Bypass。 2、為了更好的對比效果&#xff0c;大部分測試payload均使用msf的windows/meterperter/reverse_tcp模塊生成。 3、由于本機測試時只是安裝了360全家…

kotlin 或 運算_Kotlin程序對兩個數字執行算術運算

kotlin 或 運算Here, we are implementing a Kotlin program to perform various arithmetic operations on two numbers. 在這里&#xff0c;我們正在實現Kotlin程序&#xff0c;以對兩個數字執行各種算術運算 。 Given two numbers a and b, we have to find addition, sub…

2012.1.15---學習筆記

最近學習實踐的內容主要有&#xff1a;1 memcahche的安裝、使用&#xff08;為了減少數據庫壓力而采用的&#xff09;2 linux下的定時任務的配置&#xff0c;crontab3 如何去編寫可配置的php程序&#xff08;加載配置文件&#xff09;1 memcahche的安裝、使用&#xff08;為了減…

WPF界面設計技巧(2)—自定義漂亮的按鈕樣式

上次做了個很酷的不規則窗體&#xff0c;這次我們來弄點好看的按鈕出來&#xff0c;此次將采用純代碼來設計按鈕樣式&#xff0c;不需要 Microsoft Expression Design 輔助了。 首先打開 Microsoft Visual Studio 2008 &#xff0c;新建一個WPF項目&#xff0c;在上面隨便放幾個…

ropgadgets與ret2syscall技術原理

程序&#xff1a; #include <stdio.h> #include <string.h> #include <sys/types.h> #include <unistd.h> #include <sys/syscall.h> void exploit() { system("/bin/sh"); } void func() { char str[0x20]; read(0,str,0x50); } int…

uboot load address、entry point、 bootm address以及kernel運行地址的意義及聯系

按各地址起作用的順序&#xff0c;uboot引導linux內核啟動涉及到以下地址&#xff1a; load address&#xff1a;entry point&#xff1a; 這兩個地址是mkimage時指定的bootm address&#xff1a;bootm為uboot的一個命令&#xff0c;以此從address啟動kernelkernel運行地址&…

Java——集合(Map集合的兩種迭代)

一&#xff0c;Map集合的第一種迭代 Map集合的第一種迭代&#xff0c;通過get(key)方法&#xff0c;根據鍵去獲取值 package com.wsq.map;import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set;public class Demo2_Iterator { …