Android Stdio的学习 5
今天又做了另外的页面。
<?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:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" tools:context="com.mingrisoft.Main2Activity"> <Button android:id="@+id/btn2" android:layout_width="80dp" android:layout_height="50dp" android:text="返回" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> <EditText android:id="@+id/et_3" android:layout_width="match_parent" android:layout_height="40dp" android:textColor="#870c0c" android:hint="请输入金额:" android:background="#9bc9e1" android:textSize="20dp" android:layout_marginTop="44dp" android:layout_below="@+id/ou_2" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> <TextView android:id="@+id/ou_1" android:layout_width="match_parent" android:layout_height="40dp" android:text="属性" android:textColor="#f9f6f6" android:textSize="20dp" android:layout_above="@+id/btn4" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginBottom="41dp"></TextView> <TextView android:id="@+id/ou_2" android:layout_width="match_parent" android:layout_height="40dp" android:text="金额" android:textColor="#f9f6f6" android:textSize="20dp" android:layout_marginTop="35dp" android:layout_below="@+id/btn2" android:layout_alignParentLeft="true" android:layout_alignParentStart="true"></TextView> <Button android:id="@+id/btn3" android:layout_width="match_parent" android:layout_height="70dp" android:text="支出" android:textColor="#f04b4b" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> <Button android:id="@+id/btn4" android:layout_width="match_parent" android:layout_height="60dp" android:text="收入" android:textColor="#6597ed" android:layout_above="@+id/btn3" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginBottom="45dp" /> </RelativeLayout>
package com.mingrisoft; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.View; public class Main2Activity extends ActionBarActivity implements View.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); initUI(); } private void initUI() { findViewById(R.id.btn2).setOnClickListener(this); findViewById(R.id.btn3).setOnClickListener(this); findViewById(R.id.btn4).setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.btn2: //跳转到EditTextAxctivity界面 Intent intent = new Intent(); intent.setClass(getApplicationContext(), EditTextActivity.class); startActivity(intent); break; case R.id.btn3: //跳转到OutAxctivity界面 intent = new Intent(); intent.setClass(getApplicationContext(), OutActivity.class); startActivity(intent); break; case R.id.btn4: //跳转到InAxctivity界面 intent = new Intent(); intent.setClass(getApplicationContext(), InActivity.class); startActivity(intent); break; } } }