<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.test1.MainActivity" >

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText1"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignRight="@+id/button1"
android:layout_below="@+id/textView1"
android:layout_marginTop="59dp"
android:text="只读文本"
android:textSize="15pt"
android:textColor="#0092c7" />

<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="55dp"
android:ems="10"
android:hint="删除完成后显示,提示功能"
android:text="文本框测试" >

<requestFocus />
</EditText>

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginTop="85dp"
android:hint="确定功能提示"
android:text="@string/btn1Text"
android:textStyle="bold" />

<Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_below="@+id/button1"
android:layout_marginTop="18dp"
android:hint="弹窗功能提示"
android:text="@string/btn2Text"
android:textStyle="bold" />

<Button
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_alignRight="@+id/Button01"
android:layout_below="@+id/Button01"
android:layout_marginTop="28dp"
android:hint="下拉窗功能提示"
android:text="@string/btn3Text"
android:textStyle="bold" />

</RelativeLayout>

///////////////////////////////////////////////////////////////////////////////////////////

package com.example.test1;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;

public class Popu_TC extends ActionBarActivity {

////////////////////
private EditText Text_Popu;
////////////////////

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_popu__tc);

////////1///////////
Text_Popu = (EditText)findViewById(R.id.editText_Popu);
////////////////////

////////2///////////
Bundle bunde = this.getIntent().getExtras();
//String strs = bunde.getString("key3").toString();
Text_Popu.setText(bunde.getString("key3").toString());
////////////////////

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.popu__tc, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}


///////////////////////////////////////////////////////////////////////////////////////////

package com.example.test1;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

////////////////////
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.content.Intent;
////////////////////

public class MainActivity extends ActionBarActivity {

////////////////////
private Button myButton;
private EditText myText;

private Button myButton01;
private Button myButton02;
////////////////////

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//////////1/////////
myButton = (Button)findViewById(R.id.button1);
myText = (EditText)findViewById(R.id.editText1);

myButton.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
myText.setText("弄明白监听!");
}
});

////////////////////


/////////2//////////
myButton01 = (Button)findViewById(R.id.Button01);
myButton01.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
////显示文本------- 测试通过
//myText.setText("弄明白监听2!");

////intent负责程序跳转和传递数据
//Intent intent = new Intent(this,F1_TC.class);
//startActivity(intent);
//Toast.makeText(this, "Toast", Toast.LENGTH_SHORT).show();

Intent intent = new Intent(MainActivity.this, F1_TC.class);
startActivity(intent);


////打开一个伪窗口------- 测试通过
//Toast.makeText(getApplicationContext(), "提示:点击窗口外部关闭窗口!",
//Toast.LENGTH_SHORT).show();

}
});
////////////////////

/////////3//////////
myButton02 = (Button)findViewById(R.id.Button02);
myButton02.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

////intent负责程序跳转和传递数据
Intent intent = new Intent(MainActivity.this,Popu_TC.class);

Bundle bundle = new Bundle(); //通过Bundle实现数据的传递:
bundle.putString("key1", "value1"); // key1为名,value1为值
bundle.putString("key2", myButton02.toString());
bundle.putString("key3", myText.getText().toString());
bundle.putInt("keyInt1", 100); //整数类型
intent.putExtras(bundle); // 传数据


startActivity(intent); // ------- 测试通过 //不需要子窗口回传数据
//startActivityForResult(intent, 1); //requestCode是子窗口的id标志,而且必须大于1,否则回调函数onActivityResult不响应!

}
});
////////////////////


}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.

int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}


}


更多相关文章

  1. android post方式传递参数并获取返回数据代码
  2. android序列化与反序列话HashMap到sqlite数据库
  3. android 数据存储总结及各种存储方式
  4. Android前端通过Http协议与J2EE后端数据交互。工具eclipse、MySQ
  5. 自定义Toast,兼容那些安装时把通知关掉还问为啥不给提示的测试人
  6. Android P九轴传感器数据读取
  7. Android 更新提示的AlertDialog
  8. Android Window 二 可移动悬浮窗口 WindowManager

随机推荐

  1. 相机 android java.lang.RuntimeExceptio
  2. 实验三、AndroidUI组件
  3. android对大图片的缓存处理
  4. android亮屏、暗屏、解锁、关闭系统对话
  5. Android爬坑-悬浮窗显示位置问题
  6. SharedPreferences 源码分析
  7. android的文件操作
  8. android GPS定位 经纬度确定
  9. Android(安卓)Lamda 学习
  10. Android跳转系统相机或相册获取图片