Android Studio欢迎界面和登陆界面的设计(小白)

这篇具有很好参考价值的文章主要介绍了Android Studio欢迎界面和登陆界面的设计(小白)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

        最近学校开设了Android Studio的开发课程,跟着书上的例子和小破站的视频开启了安卓小白之旅,今天主要整理了一下"欢迎界面"和"登陆界面"的相关内容。

        首先新建一个项目,按照自己的需求命名项目

Android Studio欢迎界面和登陆界面的设计(小白)

 欢迎界面

新建一个类,命名为Splash

Android Studio欢迎界面和登陆界面的设计(小白)

 欢迎界面的页面布局

在layout中新建一个activity_splash.xml文件,

需要首先在drawable文件夹下导入main_button_3图片,字体颜色可以自己按照喜好设计

activity_splash.xml布局设计如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@drawable/main_button_3"
        >

        <TextView
            android:id="@+id/textView"
            android:layout_marginTop="20dp"
            android:layout_marginLeft="80dp"
            android:layout_width="210dp"
            android:layout_height="wrap_content"
            android:text="我们的征途是星辰大海"
            android:textColor="@color/royalblue"
            android:textSize="40sp"
            android:textStyle="bold" />


    </LinearLayout>
</LinearLayout>

效果如图

Android Studio欢迎界面和登陆界面的设计(小白)

 Splash.java中代码如下:

package com.example.chwngyanan.qxapp.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.example.chwngyanan.qxapp.MainActivity;
import com.example.chwngyanan.qxapp.R;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by CHWNGYANAN on 2021/9/20.
 */

public class Splash extends AppCompatActivity{
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);  //快捷键alt+enter

        //延时操作
        Timer timer = new Timer();
        timer.schedule(timetast, 2000);
    }
        TimerTask timetast = new TimerTask() {
            @Override
            public void run() {
           
                startActivity(new Intent(Splash.this,Login.class));//跳转登录界面
            }
        };



}

 Splash中要实现的功能是在欢迎界面停留两秒后跳转登陆界面

登陆界面

由于作者是小白,设计的登陆界面比较简单

新建Login类以及activity_login.xml

activity_login.xml布局文件如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
        android:background="@drawable/main_button_3_selected"
        android:gravity="center">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="30dp"
            android:paddingTop="20dp"
            android:background="#99404348"
            android:gravity="center">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="Welcome"
                android:textColor="#FFFFFF"
                android:textSize="18sp"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingBottom="20dp"
            android:paddingTop="20dp"
            android:background="#99000000">
            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@null"
                android:layout_gravity="center"
                android:layout_marginRight="50dp"
                android:layout_marginLeft="50dp"
                android:textColor="#9F9FA0"
                android:textColorHint="#9F9FA0"
                android:hint="your username"/>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dip"
                android:background="#83738F"
                android:layout_marginRight="40dp"
                android:layout_marginLeft="40dp"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="5dp"></View>

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@null"
                android:layout_gravity="center"
                android:hint="your password"
                android:textColor="#9F9FA0"
                android:textColorHint="#9F9FA0"
                android:layout_marginLeft="50dp"
                android:layout_marginRight="50dp"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="30dp"
            android:paddingTop="20dp"
            android:background="#99404348"
            android:gravity="center"
            android:orientation="horizontal">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="Forget Password?"
                android:textColor="#DDDDDD"
                android:textSize="15sp"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="Tap Here"
                android:textColor="#FFFFFF"
                android:textSize="15sp"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <Button
                android:id="@+id/login"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="40dp"
                android:layout_marginRight="10dp"
                android:layout_weight="1"
                android:background="@color/royalblue"
                android:text="Login"/>
            <Button
                android:id="@+id/zhuce"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="40dp"
                android:layout_marginLeft="10dp"
                android:background="@color/royalblue"
                android:layout_weight="1"
                android:text="Sign in"/>
        </LinearLayout>

    </LinearLayout>

</LinearLayout>

效果如图:

Android Studio欢迎界面和登陆界面的设计(小白)

同样需要注意在drawable中导入名为main_button_3_selected的图片(图片名称可以自己命名,和xml文件中对应即可)

接下来要实现的功能是点击登录注册跳转注册界面

新建Register类以及activity_register.xml文件

activity_register.xml布局文件如下

<?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:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_margin="10dp"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_marginTop="20dp"
            android:gravity="center"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            tools:ignore="UselessParent">

            <TextView
                android:textStyle="bold"
                android:textSize="24sp"
                android:text="@string/数字账号"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/输入账号"/>
        </LinearLayout>

        <LinearLayout
            android:layout_marginTop="20dp"
            android:gravity="center"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            tools:ignore="UselessParent">

            <TextView
                android:textStyle="bold"
                android:textSize="24sp"
                android:text="@string/数字密码"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <EditText

                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/请输入您的密码"/>

        </LinearLayout>
        <LinearLayout
            android:layout_marginTop="20dp"
            android:gravity="center"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:textStyle="bold"
                android:textSize="24sp"
                android:text="@string/具体昵称"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <EditText

                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/请输入您的昵称"/>
        </LinearLayout>
    </LinearLayout>
    <Button
        android:id="@+id/register"
        android:layout_margin="10dp"
        android:background="@color/colorPrimaryDark"
        android:textSize="20sp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/注册账号"/>

</LinearLayout>

设计效果如图

Android Studio欢迎界面和登陆界面的设计(小白)

 Register.java文件代码如下:

 实现的功能是当点击"注册账号"按钮时,跳转登录界面,并且显示“注册成功,请重新登录”字样

package com.example.chwngyanan.qxapp.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.chwngyanan.qxapp.MainActivity;
import com.example.chwngyanan.qxapp.R;

/**
 * Created by CHWNGYANAN on 2021/9/23.
 */

public class Register extends AppCompatActivity {
    private Button register;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);

        //绑定按钮
        register = (Button)findViewById(R.id.register);
        register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(Register.this, "注册成功,请重新登录", Toast.LENGTH_SHORT).show();
                startActivity(new Intent(Register.this,Login.class));
            }
        });
    }
}

Login.java要实现的功能是 :点击登录,跳转主界面,并显示“登录成功”字样

Login.java中代码如下

package com.example.chwngyanan.qxapp.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.example.chwngyanan.qxapp.MainActivity;
import com.example.chwngyanan.qxapp.R;

/**
 * Created by CHWNGYANAN on 2021/9/22.
 */

public class Login extends AppCompatActivity {
    private Button login;
    private Button zhuce;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        //绑定控件
        login = (Button)findViewById(R.id.login);
        zhuce = (Button)findViewById(R.id.zhuce);

        login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(Login.this, "登陆成功",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(Login.this, MainActivity.class));
            }
        });
        //注册界面
        zhuce.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(Login.this,Register.class));
            }
        });

    }
}

最后实现的效果如下:

 

Android Studio欢迎界面和登陆界面的设计(小白)

 

Android Studio欢迎界面和登陆界面的设计(小白)文章来源地址https://www.toymoban.com/news/detail-497632.html

到了这里,关于Android Studio欢迎界面和登陆界面的设计(小白)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • android studio——设计简单微信界面超详细教程

    一、作业目标 本次作业开发的是微信APP的门户框架,UI布局为上中下结构。 功能一:用户可通过点击底部导航栏切换四个板块进行切换,它们分别是“聊天”、“联系人”、“功能”、“我的”,每切换一个界面会有对应的文本提示。 功能二:在每一tab页面实现列表效果。

    2024年02月04日
    浏览(47)
  • 蓝牙聊天App设计1:Android Studio制作蓝牙聊天通讯软件(UI界面设计)

    前言:蓝牙聊天App设计全部有三篇文章(一、UI界面设计,二、蓝牙搜索配对连接实现,三、蓝牙连接聊天),这篇文章是一、UI界面设计 课程1:Android Studio小白安装教程,以及第一个Android项目案例“Hello World”的调试运行 课程2:蓝牙聊天App设计1:Android Studio制作蓝牙聊天通

    2024年02月02日
    浏览(37)
  • Android 实现用户登陆界面

    Button是TextView的一个子类,EditView同样也是TextView的子类 其中,EditView是一个可输入内容的组件 参考属性文档 :包含EditText控件的常用属性 常用基本属性介绍: 属性 含义 textAllCaps 设置字体大小写,android:textAllCaps=\\\"false\\\"表示字体显示和输入的内容一致 hint 设置文本框初始显示

    2024年02月07日
    浏览(30)
  • Android Studio小白踩坑记录

    写在前面,本人纯纯安卓小白,自己摸索着用Android Studio,遇到了不少问题,在这里记录一下 Android Studio推荐版本问题 我其实不太建议小白直接上来用最新的Android Studio版本,高版本的是kotlin语言编写的。我这里用的是2021版本的,小白用java语言较好。 gradle安装太慢 这个是安

    2024年02月22日
    浏览(28)
  • Android Studio小白安装教程,以及第一个Android项目案例的调试运行

    小白友好型教学: 本文从小白角度出发,手把手教你一步一步成功安装“Android Studio”,并结合案例,编写你的第一个手机APP到手机上运行。由于安装过程较长,建议大家跟着截图,注意细节,不然容易出错。 本次任务内容: 任务1:Java 安装 任务2:Android Studio 安装 任务3:

    2024年02月08日
    浏览(42)
  • Android Studio入门级教程(详细)【小白必看】[通俗易懂]

    Android Studio如何使用 本文主要讲解一下Android Studio使用方法 步骤: 1.建立项目 首先点击new——new project新建项目 选择想要创建的Android 的模板,建议选择empty activity(空模板),然后next Name:给你的项目起一个名字 API level:选择Android 虚拟机的版本,版本越低运行起来越快 剩

    2024年02月08日
    浏览(41)
  • Android Studio——实现登录界面

    Android Studio——实现登录界面 在移动应用开发中,登录界面是一种常见的设计需求。通过使用Android Studio,我们可以轻松实现一个简单且美观的登录界面。本文将介绍如何使用Android Studio创建一个登录界面,并提供相应的源代码。 步骤1:创建新项目 首先,打开Android Studio并创

    2024年02月08日
    浏览(27)
  • Android studio界面ui优化

    记录一下对毕设界面的优化 效果图: 方法:创建xml文件,然后引用该xml文件: 有时候下边框可以直接用view实现,我是因为不想把tablelayout改成linearlayout所以没用这个方法 view方法: 背景透明并取消阴影 效果图: 点击按钮变色 效果图 同样创建xml文件 然后在代码块中设置点

    2024年02月13日
    浏览(27)
  • Android Studio制作简单登录界面

    应用线性布局设计登录界面,要求点击输入学号时弹出数字键盘界面,点击输入密码时弹出字母键盘,出现的文字、数字、尺寸等全部在values文件夹下相应.xml文件中设置好,使用时直接引用。当用户名或密码为空,显示一个提示信息“用户名与密码不能为空!”,当用户名和

    2024年04月15日
    浏览(40)
  • 小白配置java环境与Android Studio目前最新版下载安装

    Android Studio 是用于开发 Android 应用的官方集成开发环境 (IDE)。Android Studio 基于 IntelliJ IDEA 强大的代码编辑器和开发者工具,还提供更多可提高 Android 应用构建效率的功能,例如: 基于 Gradle 的灵活构建系统 快速且功能丰富的模拟器 统一的环境(供您开发适用于所有 Android

    2024年02月04日
    浏览(44)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包