-1
我只是想了解的基礎知識。我有如下一個非常簡單的activity_main.xml中:onClick導航到新的窗口在Android應用程序
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
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=".MainActivity" >
<Button
android:id="@+id/view_private"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:onClick="seePrivateGroups"
android:text="View Private Circle"/>
<Button
android:id="@+id/join_private"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/join_global"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:onClick="joinPrivate"
android:text="Join A Private PrayerCircle" />
<Button
android:id="@+id/join_global"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/view_private"
android:layout_centerHorizontal="true"
android:layout_marginBottom="24dp"
android:onClick="joinGlobal"
android:text="Join the global PrayerCircle" />
<EditText
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/view_private"
android:layout_marginTop="30dp"
android:ems="10"
android:hint="Email:"
android:inputType="textEmailAddress"
android:textSelectHandleLeft="@+id/email_tag" />
<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/email"
android:layout_below="@+id/email"
android:ems="10"
android:inputType="textPassword"
android:hint="Password:" />
<Button
android:id="@+id/sign_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/join_private"
android:layout_below="@+id/password"
android:onClick="signUp"
android:text="Sign Up" />
<Button
android:id="@+id/sign_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/sign_up"
android:layout_alignBottom="@+id/sign_up"
android:layout_alignLeft="@+id/join_global"
android:onClick="menu"
android:text="Sign In" />
</RelativeLayout>
然後我也有如下所示我MainActivity.java:
//the main activity function
public class MainActivity extends Activity {
//this function is run when the application process is created
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialize the application with the two keys: application ID and client key
Parse.initialize(getApplication(), "TAKEN-OUT", "TAKEN-OUT");
//to track the uses
ParseAnalytics.trackAppOpened(getIntent());
}
protected void onStart(Bundle savedInstanceState) {
super.onStart();
setContentView(R.layout.activity_main);
}
//some code removed from here.
@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;
}
}
我想導航到新頁面時註冊按鈕被點擊。我需要一個新的XML文件嗎?還是我可以將它保存在activity_main.xml中?你能給我提供一些關於我在哪裏放置新頁面的XML數據的指導嗎?我該如何指定我希望這個點擊進入一個新頁面