package com.example.onlinestore; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { public void click(View view){ Toast.makeText(MainActivity.this,"登陆成功",Toast.LENGTH_SHORT).show(); Intent intent = new Intent(MainActivity.this, ShouOneActivity.class); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); startActivity(intent); } public void zc(View view){ Intent intent = new Intent(); intent.setClass(MainActivity.this, ZhuceActivity.class); startActivity(intent); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView t=(TextView) findViewById(R.id.button1); } } package com.example.onlinestore; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class ZhuceActivity extends AppCompatActivity { public void click(View view){ Intent intent = new Intent(ZhuceActivity.this, MainActivity.class); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); startActivity(intent); } public void fanhui(View view){ Toast.makeText(ZhuceActivity.this,"注册成功",Toast.LENGTH_SHORT).show(); Intent intent = new Intent(); intent.setClass(ZhuceActivity.this, MainActivity.class); startActivity(intent); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_zhuce); TextView t=(TextView) findViewById(R.id.button2); } }
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:layout_editor_absoluteX="60dp" tools:layout_editor_absoluteY="-53dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="138dp" android:orientation="horizontal"> <TextView android:id="@+id/textView4" android:layout_width="197dp" android:layout_height="wrap_content" android:layout_marginLeft="110dp" android:layout_marginTop="90dp" android:text="OnlineStore" android:textColor="#2C2C2C" android:textSize="36sp" android:textStyle="bold|italic" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="115dp" android:orientation="horizontal"> <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="90dp" android:layout_marginTop="10dp" android:layout_weight="1" app:srcCompat="@drawable/enterone" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="69dp" android:orientation="horizontal"> <ImageView android:id="@+id/imageView3" android:layout_width="38dp" android:layout_height="34dp" android:layout_marginLeft="90dp" android:layout_marginTop="10dp" app:srcCompat="@drawable/enterthree" /> <EditText android:id="@+id/editText" android:layout_width="207dp" android:layout_height="50dp" android:layout_marginTop="2dp" android:ems="10" android:inputType="phone" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="69dp" android:orientation="horizontal"> <ImageView android:id="@+id/imageView4" android:layout_width="35dp" android:layout_height="35dp" android:layout_marginLeft="90dp" android:layout_marginTop="20dp" app:srcCompat="@drawable/enterotwo" /> <EditText android:id="@+id/editText" android:layout_width="210dp" android:layout_height="50dp" android:layout_marginTop="10dp" android:ems="10" android:inputType="phone" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="96dp" android:orientation="horizontal"> <Button android:id="@+id/button" android:layout_width="208dp" android:layout_height="wrap_content" android:layout_marginLeft="110dp" android:layout_marginTop="20dp" android:onClick="click" android:text="LOGIN" android:textSize="18sp" android:textStyle="bold|italic" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="96dp" android:orientation="horizontal"> <Button android:id="@+id/button1" android:layout_width="208dp" android:layout_height="wrap_content" android:layout_marginLeft="110dp" android:onClick="zc" android:text="LOG0N" android:textSize="18sp" android:textStyle="bold|italic" /> </LinearLayout> </LinearLayout> </android.support.constraint.ConstraintLayout> <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ZhuceActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:layout_editor_absoluteX="60dp" tools:layout_editor_absoluteY="-53dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="138dp" android:orientation="horizontal"> <TextView android:id="@+id/textView4" android:layout_width="197dp" android:layout_height="wrap_content" android:layout_marginLeft="110dp" android:layout_marginTop="90dp" android:text="OnlineStore" android:textColor="#2C2C2C" android:textSize="36sp" android:onClick="fanhui" android:textStyle="bold|italic" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="115dp" android:orientation="horizontal"> <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="90dp" android:layout_marginTop="10dp" android:layout_weight="1" app:srcCompat="@drawable/enterone" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="69dp" android:orientation="horizontal"> <ImageView android:id="@+id/imageView3" android:layout_width="38dp" android:layout_height="34dp" android:layout_marginLeft="90dp" android:layout_marginTop="10dp" app:srcCompat="@drawable/enterthree" /> <EditText android:id="@+id/editText" android:layout_width="207dp" android:layout_height="50dp" android:layout_marginTop="2dp" android:ems="10" android:inputType="phone" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="69dp" android:orientation="horizontal"> <ImageView android:id="@+id/imageView4" android:layout_width="35dp" android:layout_height="35dp" android:layout_marginLeft="90dp" android:layout_marginTop="20dp" app:srcCompat="@drawable/enterotwo" /> <EditText android:id="@+id/editText" android:layout_width="210dp" android:layout_height="50dp" android:layout_marginTop="10dp" android:ems="10" android:inputType="phone" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="96dp" android:orientation="horizontal"> <Button android:id="@+id/button2" android:layout_width="208dp" android:layout_height="wrap_content" android:layout_marginLeft="110dp" android:layout_marginTop="10dp" android:onClick="fanhui" android:text="LOG0N" android:textSize="18sp" android:textStyle="bold|italic" /> </LinearLayout> </LinearLayout> </android.support.constraint.ConstraintLayout>