Android简单页面跳转
分类:
技术
简介:代码结构本次项目需要添加的“代码块”如下 👇 layout部分login(登录页面)<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|bottom">
<ImageView
android:layout_marginTop="100dp"
android:layout_width="200dp"
android:layout_height="100dp"
android:src="@drawable/lxy"
android:scaleType="centerCrop"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="灵心云·登录"
android:textSize="20dp"
android:gravity="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="15dp">
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="请输入用户名"
android:textSize="18dp"
android:background="@drawable/button_round"
android:padding="10dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="输入用户密码"
android:textSize="18dp"
android:password="true"
android:background="@drawable/button_round"
android:padding="10dp"
android:layout_marginTop="15dp"
tools:ignore="Deprecated" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/bt1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="登录"
android:textSize="20dp"
android:padding="10dp"
android:textColor="#ffffff"
android:background="@drawable/button_round2"
android:layout_marginLeft="30dp"
android:layout_marginRight="15dp"/>
<Button
android:id="@+id/bt2"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="注册"
android:textSize="20dp"
android:padding="10dp"
android:textColor="#ffffff"
android:background="@drawable/button_round2"
android:layout_marginLeft="10dp"
android:layout_marginRight="30dp"/>
</LinearLayout>
</LinearLayout>register(注册页面)<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|bottom">
<ImageView
android:layout_marginTop="100dp"
android:layout_width="200dp"
android:layout_height="100dp"
android:src="@drawable/lxy"
android:scaleType="centerCrop"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="灵心云·注册"
android:textSize="20dp"
android:gravity="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="15dp">
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="请输入用户名"
android:textSize="18dp"
android:background="@drawable/button_round"
android:padding="10dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="输入用户密码"
android:textSize="18dp"
android:password="true"
android:background="@drawable/button_round"
android:padding="10dp"
android:layout_marginTop="15dp"
tools:ignore="Deprecated" />
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="再次输入密码"
android:textSize="18dp"
android:password="true"
android:background="@drawable/button_round"
android:padding="10dp"
android:layout_marginTop="15dp"
tools:ignore="Deprecated" />
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="输入邮箱地址"
android:textSize="18dp"
android:background="@drawable/button_round"
android:padding="10dp"
android:layout_marginTop="15dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/bt4"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="立即注册"
android:textSize="20dp"
android:padding="10dp"
android:textColor="#ffffff"
android:background="@drawable/button_round2"
android:layout_marginLeft="30dp"
android:layout_marginRight="15dp"/>
<Button
android:id="@+id/bt5"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="返回登录"
android:textSize="20dp"
android:padding="10dp"
android:textColor="#ffffff"
android:background="@drawable/button_round2"
android:layout_marginLeft="10dp"
android:layout_marginRight="30dp"/>
</LinearLayout>
</LinearLayout>home(首页)<?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">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="这是首页"
android:textSize="100dp"/>
</LinearLayout>drawable部分lxy.png用于装饰的图片,自己随便加一张button_round - 隐藏 - button_round2 - 隐藏 - main部分这里作者是自己全部粘贴过来了,代码中我已经做了相关注释,可以自己慢慢打,注意多用快捷键MainActivity - 隐藏 - 给登录页面(login)加一个判断 - 隐藏 - home_1 - 隐藏 - register_1 - 隐藏 - AndroidManifest部分添加注册 - 隐藏 - 到这里基本上就OK了。如果你是Android studio,可能需要进行下面的配置如果你的登录/注册不是下面这个样子,你需要vaues >themes替换代码 👇 - 隐藏 - 替换位置👇 - 隐藏 -
免费部署一个自己的“Chatgpt”
分类:
技术
简介:前言之前我在GitHub上“无意”中看到了一个部署gpt的项目,觉得好玩儿,就自己部署了一个,之后就没怎么管了 没想到还有“圈钱” ,圈就算了,连源码都改不干净👇 所以咱就给大家分享一下,如何快速部署一个gpt来玩,只需要动动你聪明的头脑以及你敏捷的小手指就OK了这里我们需要用到一个GitHub的账号,没有的小伙伴可以先去注册,这里就不教大家怎么注册了登录GitHub点击这里 👈fork项目点击这里👈Repository name自己随便填就OK到这里,我们就准备好了项目文件登录Vercel点击这里👈添加项目import项目运行访问添加一个自己的域名简单修改使用页面简单修改 👇路径:app >layout.tsx路径:app >components >sidebar.tsx在99行左右其他修改其他的这里我们就不作教学了,相信你会🥰newbingAI部署源码 👇 - 隐藏 -
免费部署个人主页【少女心】
分类:
技术
简介:示例前言在此之前,我们已经使用了 Vercel,并且已经配置了 ChatGPT的 web版本。这一次,我们希望为您提供一个更加简便的,单页的个人网页注意事项步骤fork项目点击这里登录Vercel并导入项目点击这里ps后续也会上传其他的源码,记得关注我的Github哦~
禁止F12和右键
分类:
技术
简介:示例代码JS代码 // Listen for the "keydown" event on the document
document.addEventListener("keydown", function(event) {
// Check if the pressed key is F12 (keyCode 123)
if (event.keyCode === 123) {
// Create a new <div> element for the message
var messageDiv = document.createElement("div");
messageDiv.className = "message div";
// Set the content of the <div>
messageDiv.textContent = "代码不好看~";
// Append the <div> to the body
document.body.appendChild(messageDiv);
// Remove the <div> after a few seconds (optional)
setTimeout(function() {
document.body.removeChild(messageDiv);
}, 3000); // Remove after 3 seconds (adjust as needed)
}
});
// Listen for the "contextmenu" event on the document
document.addEventListener("contextmenu", function(event) {
// Prevent the default right click context menu
event.preventDefault();
// Show the right click prompt
showPrompt("代码不好看~");
});
// Function to show a prompt
function showPrompt(message) {
// Create a new <div> element for the message
var messageDiv = document.createElement("div");
messageDiv.className = "message div";
// Set the content of the <div>
messageDiv.textContent = message;
// Append the <div> to the body
document.body.appendChild(messageDiv);
// Remove the <div> after a few seconds (optional)
setTimeout(function() {
document.body.removeChild(messageDiv);
}, 3000); // Remove after 3 seconds (adjust as needed)
}CSS /* Styles specific to the message div */
.message div {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX( 50%);
padding: 10px;
background color: #ffcccc;
border: 1px solid #e74c3c;
color: #e74c3c;
border radius: 5px;
z index: 9999; /* Ensure it's above other elements */
进站显示IP
分类:
技术
简介:
<div id="fps" style="z index:5;position:fixed;bottom:3px;left:3px;color:#2196F3;font size:10px;">
</div>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/kaliisra/myblogstatic/kehuduan js/fetch.min.js">
</script>
<script src="https://cdn.gmit.vip/layer/3.1.1/layer.js" type="text/javascript"
charset="utf 8">
</script>
<script>
$(function() {
if (
/*getCookie('msg') !=*/
1) {
var t = document.createElement("a");
t.href = document.referrer;
var msgTitle = t.hostname;
var name = t.hostname.split(".")[1];
if ("" !== document.referrer) {
switch (name) {
case 'bing':
msgTitle = '必应搜索';
break;
case 'baidu':
msgTitle = '百度搜索';
break;
case 'so':
msgTitle = '360 搜索';
break;
case 'google':
msgTitle = '谷歌搜索';
break;
case 'sm':
msgTitle = '神马搜索';
break;
case 'sogou':
msgTitle = '搜狗搜索';
break;
default:
msgTitle = t.hostname;
};
};
var time = (new Date).getHours();
var msg = '';
23 < time || time <= 5 ? msg = "你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?": 5 < time && time <= 7 ? msg = "早上好!一日之计在于晨,美好的一天就要开始了!": 7 < time && time <= 11 ? msg = "上午好!工作顺利嘛,不要久坐,多起来走动走动哦!": 11 < time && time <= 14 ? msg = "中午了,工作了一个上午,现在是午餐时间!": 14 < time && time <= 17 ? msg = "午后很容易犯困呢,今天的运动目标完成了吗?": 17 < time && time <= 19 ? msg = "傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~": 19 < time && time <= 21 ? msg = "晚上好,今天过得怎么样?": 21 < time && time <= 23 && (msg = "已经这么晚了呀,早点休息吧,晚安~");
$.ajax({
type: "get",
url: "https://api.gmit.vip/Api/UserInfo/",
async: true,
success: function(data) {
window.info = data;
layer.msg("Hi~ 来自" + data.data.location + '~<br/>通过 ' + msgTitle + ' 进来的朋友!<br/>使用 ' + data.data.os + "<br/>" + data.data.browser + ' 访问本站!' + '<br/>' + msg);
var showFPS = (function() {
var requestAnimationFrame = window.requestAnimationFrame window.msRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
var e, pe, pid, fps, last, offset, step, appendFps;
fps = 0;
last = Date.now();
step = function() {
offset = Date.now() last;
fps += 1;
if (offset >= 1000) {
last += offset;
appendFps(fps);
fps = 0;
};
requestAnimationFrame(step);
};
appendFps = function(fps) {
var settings = {
timeout: 5000,
logError: true
};
//$('#fps').html('<span style="float:left;">' + fps + 'FPS</span><br/><span style="float:left">' + window.info.data.os + '</span><br/><span style="float:left;margin top:1px;">' + window.info.data.browser + '</span><br/><span style="float:left;margin top:1px;">' + window.info.data.location + '</span><br/><span style="float:left;margin top:1px;"></span>');
};
step();
})();
}
});
};
});
</script>