目录
一、代码
二、最后效果
一、代码
1.先新建一个activity文件
2.注册界面的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_marginTop="-2dp"
android:background="@drawable/zisebeijing"
>
<LinearLayout
android:layout_marginTop="70dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/logo"
/>
<ImageView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="60dp"
android:src="@drawable/yinyue2"
/>
<LinearLayout
android:layout_marginTop="50dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<EditText
android:hint="手机号"
android:drawableLeft="@drawable/shouji1"
android:textSize="20dp"
android:textColorHint="@color/anzi"
android:inputType="phone"
android:padding="13dp"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:background="@drawable/bg_username"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_marginTop="15dp">
<EditText
android:hint="六位验证码"
android:drawableLeft="@drawable/yanzhengma1"
android:textSize="20dp"
android:textColorHint="@color/anzi"
android:inputType="phone"
android:padding="13dp"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:background="@drawable/bg_username"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_marginTop="15dp">
<EditText
android:hint="密码"
android:drawableLeft="@drawable/mima1"
android:textSize="20dp"
android:textColorHint="@color/anzi"
android:inputType="textPassword"
android:padding="13dp"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:background="@drawable/bg_username"
/>
</LinearLayout>
<Button
android:id="@+id/btn_zhuce"
android:layout_marginTop="50dp"
android:layout_gravity="center"
android:layout_width="278dp"
android:text="立即注册"
android:textSize="26dp"
android:textColor="@color/white"
android:background="@drawable/rounded_button"
android:layout_height="55dp"/>
</LinearLayout>
</LinearLayout>
3.在MainActivity文件中,编写如下代码
package com.example.qimosheji;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private Button mBtnLogin;
private TextView mTvLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// TextView tv_one=findViewById(R.id.tv_one);
// tv_one.setText("一键登录");
// 找到控件
mTvLogin =findViewById(R.id.tv_zhuce);
mTvLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent =null;
intent =new Intent(MainActivity.this,zhuceActivity.class);
startActivity(intent);
}
});
}
}
4...\src\main\res\drawable,在这个目录下,建立一个文件,命名为:bg_username.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="@color/white"
/>
<corners
android:radius="10dp"
/>
</shape>
二、最后效果
实现跳转
觉得有用的友友留个赞赞吧~