【Android开发】股票操盘手

【Android开发】股票操盘手


一、开发环境需求

在这里插入图片描述

二、系统功能设计

在这里插入图片描述

三、运行结果

1. 欢迎界面

在这里插入图片描述

2. 绘制参考信息

在这里插入图片描述

四、主要代码

1. WelcomeActivity.java

代码如下:

package com.android.futures;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.util.concurrent.Callable;

public class WelcomeActivity extends Activity {
	private EditText ed_name;//定义用户名编辑框对象
	private EditText ed_pass;//定义密码编辑框对象
	private Button btn;      //定义按钮对象
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_welcome);
		ed_name = (EditText) findViewById(R.id.id_name);//绑定用户名编辑框对象
		ed_pass = (EditText) findViewById(R.id.id_pass);//绑定密码编辑框对象
		btn = (Button) findViewById(R.id.id_btn);//绑定按钮对象
		btn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				//判断用户名密码编辑框是否为空
				if(ed_name.getText().toString().trim().isEmpty()||ed_pass.getText().toString().trim().isEmpty()) {
                    Toast.makeText(WelcomeActivity.this, "请输入用户命名密码", Toast.LENGTH_SHORT).show();
                }
                else {   //如果不为空 判断数据是否为 指定数据
                    if(ed_name.getText().toString().trim().equals("admin")&&ed_pass.getText().toString().trim().equals("123")) {
						//创建intent对象
                        Intent intent = new Intent(WelcomeActivity.this, MyFragmentActivity.class);
                        startActivity(intent);//启动主页面
                        finish();            //退出欢迎界面
                    }
                    else {//如果用于名 密码错误 作出提示
                        Toast.makeText(WelcomeActivity.this, "用户名密码错误", Toast.LENGTH_SHORT).show();
                    }
                }
			}
		});
	}
}

2. activity_welcome.xml

代码如下:

<?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"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/id_tv"
        android:layout_marginTop="30dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="黄金操盘手\n欢迎使用"
        android:textColor="@android:color/holo_red_light"
        android:textSize="34sp" />
    <EditText
        android:id="@+id/id_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:gravity="center"
        android:hint="请输入账号名:"
        android:textSize="20sp" />
    <EditText
        android:id="@+id/id_pass"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:gravity="center"
        android:hint="请输入密码:"
        android:textSize="20sp"
        android:inputType="textPassword"/>
    <Button
        android:layout_marginTop="20dp"
        android:id="@+id/id_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="登录"/>
</LinearLayout>

以上是主要代码,完整文件可点击链接下载

https://download.csdn.net/download/qq_45647961/19662827

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Y1wang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值