/**
*
*/
package com.himi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.LayoutInflater.Factory;
import android.view.SurfaceHolder.Callback;
/**
* @author Himi
*
*/
public class MySurfaceView extends SurfaceView implements Callback, Runnable {
private SurfaceHolder sh;
private Thread th;
private Paint paint;
private Canvas canvas;
private Resources res;
private Bitmap bp;
private Bitmap bp_backGround;
private int ScreenH, ScreenW;
private boolean flag;
public static String str_zh = "Himi";
public static String str_pass = "Android进阶群:109367315";
private int bp_x, bp_y;
private boolean flag_zh = true;
public MySurfaceView(Context context) {
super(context);
res = this.getResources();
bp = BitmapFactory.decodeResource(res, R.drawable.register);
bp_backGround = BitmapFactory.decodeResource(res, R.drawable.duola);
th = new Thread(this);
sh = this.getHolder();
sh.addCallback(this);
paint = new Paint();
paint.setColor(Color.RED);
paint.setAntiAlias(true);
this.setKeepScreenOn(true);
this.setFocusable(true);
}
public void surfaceCreated(SurfaceHolder holder) {
ScreenW = this.getWidth();
ScreenH = this.getHeight();
bp_x = ScreenW / 2 - bp.getWidth() / 2;
bp_y = ScreenH / 2 - bp.getHeight() / 2;
th.start();
}
public void draw() {
canvas = sh.lockCanvas();
paint.setColor(Color.RED);
if (canvas != null) {// 当点击home键 或者返回按键的时候canvas是得不到的,这里要注意
canvas.drawColor(Color.WHITE);
canvas.drawBitmap(bp_backGround,
-(bp_backGround.getWidth() - ScreenW), -(bp_backGround
.getHeight() - ScreenH), paint);
canvas.drawBitmap(bp, bp_x, bp_y, paint);
canvas.drawText(str_zh, bp_x + 20, bp_y + 43 + 15, paint);
String temp_pass = "";
int temp_passLength = 0;
temp_passLength = str_pass.toCharArray().length;
if (temp_passLength > 15) {
temp_passLength = 15;
}
for (int i = 0; i < temp_passLength; i++) {
temp_pass += "*";
}
canvas.drawText(temp_pass, bp_x + 21, bp_y + 79 + 15, paint);
paint.setColor(Color.YELLOW);
if (flag_zh) {
canvas.drawCircle(bp_x + 23, bp_y + 113, 4, paint);
}
sh.unlockCanvasAndPost(canvas);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float pointx = event.getX();
float pointy = event.getY();
if (pointx > bp_x + 14 && pointx < bp_x + 14 + 117) {
if (pointy > bp_y + 43 && pointy < bp_y + 43 + 15) {
// 帐号
Intent i = new Intent();
i.putExtra("count", 1);
i.putExtra("himi", str_zh);
i.setClass(MainActivity.instance, Register.class);
MainActivity.instance.startActivity(i);
}
}
if (pointx > bp_x + 14 && pointx < bp_x + 14 + 117) {
if (pointy > bp_y + 79 && pointy < bp_y + 79 + 15) {
// 密码
Intent i = new Intent();
i.putExtra("count", 2);
i.putExtra("himi", str_pass);
i.setClass(MainActivity.instance, Register.class);
MainActivity.instance.startActivity(i);
}
}
if (pointx > bp_x + 42 && pointx < bp_x + 42 + 60) {
if (pointy > bp_y + 123 && pointy < bp_y + 123 + 24) {
// 登录信息
Intent i = new Intent();
i.putExtra("count", 3);
i.putExtra("himi_zh", str_zh);
i.putExtra("himi_pass", str_pass);
i.setClass(MainActivity.instance, Register.class);
MainActivity.instance.startActivity(i);
}
}
if (pointx > bp_x + 15 && pointx < bp_x + 15 + 15) {
if (pointy > bp_y + 104 && pointy < bp_y + 104 + 15) {
// 记住帐号
flag_zh = !flag_zh;
}
}
if (pointx > bp_x + 120 && pointx < bp_x + 120 + 22) {
if (pointy > bp_y + 5 && pointy < bp_y + 5 + 22) {
// 退出
try {
MainActivity.instance.finish();
android.os.Process.killProcess(android.os.Process.myPid());
MainActivity.instance = null;
} catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return super.onTouchEvent(event);
}
public void run() {
while (!flag) {
draw();
try {
Thread.sleep(100);
} catch (Exception ex) {
Log.v("Run", "Error");
}
}
}
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
}
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Android应用源码之一个简单注册界面.zip项目安卓应用源码下载
共25个文件
class:9个
java:4个
xml:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 93 浏览量
2022-03-08
21:34:42
上传
评论
收藏 511KB ZIP 举报
温馨提示
Android应用源码之一个简单注册界面.zip项目安卓应用源码下载Android应用源码之一个简单注册界面.zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
资源推荐
资源详情
资源评论
收起资源包目录
Android应用源码之一个简单注册界面.zip (25个子文件)
Android应用源码之一个简单注册界面
Android应用源码之一个简单注册界面
Register_Project
.project 852B
default.properties 364B
bin
Register_Project.apk 167KB
com
himi
R$string.class 397B
R$layout.class 364B
MainActivity.class 992B
R$drawable.class 431B
Register.class 3KB
Register$1.class 1KB
R.class 429B
MySurfaceView.class 6KB
R$attr.class 310B
resources.ap_ 161KB
classes.dex 9KB
AndroidManifest.xml 772B
src
com
himi
MySurfaceView.java 5KB
Register.java 2KB
MainActivity.java 972B
res
values
strings.xml 176B
layout
main.xml 382B
drawable
register.jpg 9KB
icon.png 3KB
duola.jpg 147KB
.classpath 280B
gen
com
himi
R.java 735B
共 25 条
- 1
资源评论
yxkfw
- 粉丝: 76
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- LM324_datasheet.pdf
- 全新Storm+Core+API管理系统源码
- 基于RP2040的电子沙漏,使用RP2040游戏机开发板,灯板是74HC595驱动的8*8LED矩阵
- 基于SSM和VUE的商店POS积分管理系统(免费提供全套java开源项目源码+论文)
- 基于SpringBoot的“在线动漫信息平台”的设计与实现.rar
- NPP xml tools
- 基于python开发的树莓派RP2040的游戏机
- 基于SNMP网络设备MIB信息采集系统(免费提供全套java开源项目源码+论文)
- 基于SSM和VUE的五子棋游戏的设计(免费提供全套java开源项目源码+论文)
- qiun-data-charts
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功