一个简单的登陆界面
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Smart Home"
android:textColor="#2faebd"
android:textSize="30dp"
android:layout_marginTop="80dp"
android:layout_marginLeft="100dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon_zhanghao"
android:layout_marginLeft="50dp"
android:layout_marginTop="40dp"
/>
<AutoCompleteTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:layout_marginLeft="20dp"
android:hint="请输入手机号码"
/>
</LinearLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="1px"
android:background="#c0c0c0"
android:layout_marginLeft="50dp"
android:layout_marginTop="5dp">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon_mima"
android:layout_marginLeft="50dp"
android:layout_marginTop="10dp"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginLeft="20dp"
android:inputType="textPassword"
android:hint="请输入密码"
/>
</LinearLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="1px"
android:background="#c0c0c0"
android:layout_marginLeft="50dp"
android:layout_marginTop="5dp">
</LinearLayout>
<Button
android:layout_width="300dp"
android:layout_height="100px"
android:textColor="#ffffff"
android:text="登陆"
android:layout_marginLeft="45dp"
android:layout_marginTop="30dp"
android:background="@drawable/shape"
android:textSize="40px"
android:onClick="skip" />
</LinearLayout>
跳转界面的代码
package com.example.yourdad;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void skip(View view){
Intent intent = new Intent();
intent.setClass(MainActivity.this,Main2Activity.class);
startActivity(intent);
注意的是要在设计界面button加上skip,第一天没有成功就是这个原因