实现界面跳转及注册界面编写(AndroidStudio)

目录

一、代码

二、最后效果


一、代码

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>

二、最后效果

实现跳转

觉得有用的友友留个赞赞吧~

  • 9
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值