中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

哪個網(wǎng)站做外單出口好個人模板建站

哪個網(wǎng)站做外單出口好,個人模板建站,c2c電子商務平臺舉例,網(wǎng)站代碼優(yōu)化怎么做一、如何跳轉一個活動 左邊的是本活動名稱, 右邊的是跳轉界面活動名稱 Intent intent new Intent(LoginActivity.this, RegisterActivity.class); startActivity(intent); finish(); 二、如果在不同的界面?zhèn)鬟f參數(shù) //發(fā)送消息 SharedPreferences sharedPreferen…

一、如何跳轉一個活動

左邊的是本活動名稱, 右邊的是跳轉界面活動名稱

Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
finish();

?

二、如果在不同的界面?zhèn)鬟f參數(shù)

//發(fā)送消息
SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("username", username);
editor.putString("password", password);
editor.apply(); //接收消息
SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", MODE_PRIVATE);
String savedUsername = sharedPreferences.getString("username", "");
String savedPassword = sharedPreferences.getString("password", "");

三、如何讓圖片是按鈕

<ImageButtonandroid:id="@+id/imageButton"android:layout_width="50dp"android:layout_height="50dp"android:src="@drawable/s7" />

四、登錄界面

1、創(chuàng)建一個LoginActivity類,然后創(chuàng)建對應的界面文件.xml

2、注冊登錄界面,并讓登錄界面其成為主界面

        <activityandroid:name=".LoginActivity"android:exported="true"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity><activity android:name=".MainActivity"/><activity android:name=".RegisterActivity"/>

3、書寫登錄界面

<?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"><TextViewandroid:layout_width="wrap_content"android:layout_height="20dp"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="賬號:"android:textSize="20dp"/><EditTextandroid:id="@+id/usernameEditText"android:layout_width="180dp"android:layout_height="wrap_content"android:textSize="20dp"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="密碼:"android:textSize="20dp"/><EditTextandroid:id="@+id/passwordEditText"android:layout_width="180dp"android:layout_height="wrap_content"android:textSize="20dp"/></LinearLayout><TextViewandroid:layout_width="wrap_content"android:layout_height="20dp"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"><CheckBoxandroid:id="@+id/rememberPasswordCheckbox"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="記住密碼"android:layout_gravity="start"android:layout_marginStart="16dp"android:layout_marginTop="8dp"/><TextViewandroid:layout_width="80dp"android:layout_height="wrap_content"/><Buttonandroid:id="@+id/zcButton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="點擊注冊" /></LinearLayout><TextViewandroid:layout_width="wrap_content"android:layout_height="20dp"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"><Buttonandroid:id="@+id/loginButton"android:layout_width="200dp"android:layout_height="wrap_content"android:text="確認登錄" /></LinearLayout></LinearLayout>

4、書寫登錄活動代碼

package com.example.yaodian;import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Toast;import androidx.appcompat.app.AppCompatActivity;public class LoginActivity extends AppCompatActivity {EditText usernameEditText;EditText passwordEditText;Button loginButton;Button zcButton;CheckBox rememberPasswordCheckbox ;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.login);rememberPasswordCheckbox = findViewById(R.id.rememberPasswordCheckbox);usernameEditText = findViewById(R.id.usernameEditText);passwordEditText = findViewById(R.id.passwordEditText);loginButton = findViewById(R.id.loginButton);zcButton = findViewById(R.id.zcButton);loginButton.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {String inputUsername = usernameEditText.getText().toString();String inputPassword = passwordEditText.getText().toString();SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", MODE_PRIVATE);String savedUsername = sharedPreferences.getString("username", "");String savedPassword = sharedPreferences.getString("password", "");// 在這里添加登錄驗證邏輯if (inputUsername.equals(savedUsername) && inputPassword.equals(savedPassword)) {Toast.makeText(LoginActivity.this, "登錄成功", Toast.LENGTH_SHORT).show();Intent intent = new Intent(LoginActivity.this, MainActivity.class);startActivity(intent);finish();// 跳轉到 MainActivity 或其他操作} else {new AlertDialog.Builder(LoginActivity.this).setTitle("提示").setMessage("登錄失敗,用戶名或密碼錯誤").setPositiveButton("確定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {}}).show();}}});zcButton.setOnClickListener((l) -> {Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);startActivity(intent);finish();});//        // 監(jiān)聽復選框狀態(tài)變化
//        rememberPasswordCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
//            @Override
//            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//                // 根據(jù)復選框狀態(tài)來處理記住密碼邏輯
//                if (isChecked) {
//
//                } else {
//
//                }
//            }
//        });}
}

五、注冊界面

同登錄界面

<?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"><TextViewandroid:layout_width="wrap_content"android:layout_height="20dp"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="       賬號:"android:textSize="20dp"/><EditTextandroid:id="@+id/usernameEditText"android:layout_width="180dp"android:layout_height="wrap_content"android:textSize="20dp"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="       密碼:"android:textSize="20dp"/><EditTextandroid:id="@+id/passwordEditText"android:layout_width="180dp"android:layout_height="wrap_content"android:textSize="20dp"/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="確認密碼:"android:textSize="20dp"/><EditTextandroid:id="@+id/password2EditText"android:layout_width="180dp"android:layout_height="wrap_content"android:textSize="20dp"/></LinearLayout><TextViewandroid:layout_width="wrap_content"android:layout_height="50dp"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"><Buttonandroid:id="@+id/registerButton"android:layout_width="200dp"android:layout_height="wrap_content"android:text="確認注冊" /></LinearLayout></LinearLayout>
package com.example.yaodian;import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;import androidx.appcompat.app.AppCompatActivity;public class RegisterActivity extends AppCompatActivity {private EditText usernameEditText;private EditText passwordEditText;private EditText password2EditText;private Button registerButton;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.register_activity);usernameEditText = findViewById(R.id.usernameEditText);passwordEditText = findViewById(R.id.passwordEditText);password2EditText = findViewById(R.id.password2EditText);registerButton = findViewById(R.id.registerButton);registerButton.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {String username = usernameEditText.getText().toString().trim();String password = passwordEditText.getText().toString().trim();String password2 = password2EditText.getText().toString().trim();if (username.isEmpty() || password.isEmpty()) {// 彈出“請輸入賬號和密碼”的對話框new AlertDialog.Builder(RegisterActivity.this).setTitle("提示").setMessage("請輸入賬號和密碼").setPositiveButton("確定", null).show();} else if (!password.equals(password2)) {// 彈出“兩次密碼不一樣,請重新輸入”的對話框new AlertDialog.Builder(RegisterActivity.this).setTitle("提示").setMessage("兩次密碼不一樣,請重新輸入").setPositiveButton("確定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {// 清空密碼和確認密碼輸入框passwordEditText.setText("");password2EditText.setText("");}}).show();} else {// 保存注冊信息到 SharedPreferencesSharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", MODE_PRIVATE);SharedPreferences.Editor editor = sharedPreferences.edit();editor.putString("username", username);editor.putString("password", password);editor.apply();Toast.makeText(RegisterActivity.this, "注冊成功", Toast.LENGTH_SHORT).show();Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);startActivity(intent);finish();}}});}
}

六、完整工程代碼

鏈接:https://pan.baidu.com/s/13tm-AsAsJEmfJjbwyX0a3Q
提取碼:生日

需要提取碼的 加QQ:1482728006,說明來意,付費即可獲取工程

http://www.risenshineclean.com/news/49460.html

相關文章:

  • wordpress rss錯誤四川seo快速排名
  • 關于網(wǎng)站建設公司大全上海app定制開發(fā)公司
  • 北京天海網(wǎng)站建設公司黃頁網(wǎng)站推廣app咋做廣告
  • 做網(wǎng)站的公司找客戶衡陽百度推廣
  • 深圳H5網(wǎng)站開發(fā)南寧seo專員
  • 上海網(wǎng)站建設網(wǎng)頁制作邢臺備案查詢網(wǎng)
  • 贛州市開發(fā)小程序搜索優(yōu)化整站優(yōu)化
  • 網(wǎng)站備案信息查詢百度seo營銷推廣多少錢
  • 彩票投注網(wǎng)站怎樣做安徽網(wǎng)站建設優(yōu)化推廣
  • 做百度手機網(wǎng)站優(yōu)化成都seo網(wǎng)絡優(yōu)化公司
  • 阜陽網(wǎng)站建設工作室營銷圖片素材
  • 扁平風網(wǎng)站哪家培訓機構學校好
  • 高校邦營銷型網(wǎng)站建設答案semifinal
  • 找人做網(wǎng)站注意哪些女教師遭網(wǎng)課入侵視頻大全播放
  • 微信網(wǎng)站開發(fā)簡單百度如何注冊公司網(wǎng)站
  • 權大師的網(wǎng)站是哪個公司做的指數(shù)基金是什么意思
  • 西安網(wǎng)站建設那家強深圳網(wǎng)絡營銷渠道
  • 鄭州網(wǎng)站制作公司名單外貿新手怎樣用谷歌找客戶
  • 企業(yè)網(wǎng)站備案在哪個部門seo教學
  • seo外貿網(wǎng)站建設百度下載安裝2021最新版
  • 上海做響應式網(wǎng)站的公司江西seo
  • 那個網(wǎng)站做室內比較好的網(wǎng)站流量排行
  • 拉新推廣變現(xiàn)app寧德seo推廣
  • 網(wǎng)站建站卡頓怎么辦流量查詢網(wǎng)站
  • 深圳網(wǎng)站建設易佰訊寧波seo排名外包
  • 烏魯木齊經濟開發(fā)區(qū)建設局網(wǎng)站如何創(chuàng)建自己的網(wǎng)址
  • 有個藍色章魚做標志的網(wǎng)站seo和sem的聯(lián)系
  • 蘇寧易購網(wǎng)站建設的目的競價關鍵詞排名軟件
  • 大連網(wǎng)站制作師企業(yè)微信scrm
  • Wordpress搜索指定頁面內容seo網(wǎng)絡優(yōu)化推廣