xml 下一页
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml 下一页相关的知识,希望对你有一定的参考价值。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_denanden"
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.tribbyx.personalinformation.denanden">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/b"/>
<Button
android:onClick="prev"
android:text="Previous Page"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/a"
android:layout_alignParentStart="true"
android:layout_marginTop="22dp" />
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
android:id="@+id/a"
android:layout_below="@+id/b"
android:layout_alignParentStart="true" />
</RelativeLayout>
public void nextPage(View view) {
Intent intent = new Intent(this, denanden.class);
EditText t = (EditText) findViewById(R.id.Name);
String name = t.getText().toString();
t = (EditText) findViewById(R.id.City);
String city = t.getText().toString();
intent.putExtra("name", name);
intent.putExtra("city", city);
startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_denanden);
String name = getIntent().getStringExtra("name");
String city = getIntent().getStringExtra("city");
TextView a = (TextView) findViewById(R.id.a);
TextView b = (TextView) findViewById(R.id.b);
a.setText(name);
b.setText(city);
}
public void prev(View view) {
finish();
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
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.tribbyx.personalinformation.MainActivity">
<Button
android:onClick="nextPage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Next Page"
android:layout_marginBottom="181dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
<EditText
android:hint="Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:id="@+id/Name" />
<EditText
android:hint="City"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:layout_below="@+id/Name"
android:layout_alignParentStart="true"
android:layout_marginTop="22dp"
android:id="@+id/City" />
</RelativeLayout>
以上是关于xml 下一页的主要内容,如果未能解决你的问题,请参考以下文章