直播系統app原始碼,Android studio 實現app登入註冊頁面

zhibo系統開發發表於2022-12-13

直播系統app原始碼,Android studio 實現app登入註冊頁面

activity_main.xml程式碼如下

<RelativeLayout xmlns:android="
    xmlns:app="
    xmlns:tools="
    android:id="@+id/activity_login"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/amd"
    >
 
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/login_edit_pwd"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="20dp">
 
        <Button
            android:id="@+id/login_btn_login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="52dp"
            android:layout_marginRight="50dp"
            android:background="#54b4ff"
            android:text="登入"
            android:textColor="#ffffff"
            android:textSize="20sp" />
 
        <Button
            android:id="@+id/login_btn_register"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="260dp"
            android:layout_marginTop="52dp"
            android:background="#54b4ff"
            android:text="註冊"
            android:textColor="#ffffff"
            android:textSize="20sp" />
    </RelativeLayout>
 
    <EditText
        android:id="@+id/login_edit_pwd"
        android:layout_width="400dp"
        android:layout_height="60dp"
        android:layout_below="@+id/login_edit_account"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_marginStart="0dp"
        android:layout_marginLeft="0dp"
        android:layout_marginTop="0dp"
        android:drawableLeft="@android:drawable/ic_lock_idle_lock"
        android:ems="10"
        android:hint="請輸入您的密碼"
        android:inputType="textPassword" />
 
    <EditText
        android:id="@+id/login_edit_account"
        android:layout_width="400dp"
        android:layout_height="60dp"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_marginStart="6dp"
        android:layout_marginLeft="6dp"
        android:layout_marginTop="350dp"
        android:drawableLeft="@android:drawable/ic_menu_myplaces"
        android:hint="請輸入您的使用者名稱"
        android:inputType="textPersonName"
        tools:ignore="UnknownId" />
 
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/login_edit_pwd"
        >
 
        <CheckBox
            android:id="@+id/Login_Remember"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:checked="false"
            android:text="記住密碼"
            android:textSize="15sp"/>
        <Button
            android:id="@+id/login_btn_forgetregister"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:layout_marginRight="0dp"
            android:backgroundTint="#ffffff"
            android:text="忘記密碼"
            android:textColor="#000000"
            android:textSize="15sp"/>
 
    </LinearLayout>
</RelativeLayout>


MainActivity.java程式碼如下

package com.example.myapplication;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
 
import com.example.myapplication.R;
 
public class MainActivity extends AppCompatActivity{
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button button=(Button)findViewById(R.id.login_btn_forgetregister);
        button.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){new AlertDialog.Builder(MainActivity.this).setTitle("系統提示").setMessage("請輸入驗證資訊進行驗證!")
                    .setPositiveButton("確定",new DialogInterface.OnClickListener(){
                        @Override
                        public void onClick(DialogInterface dialog,int which){
                            finish();
                        }
                    }).setNegativeButton("返回",new DialogInterface.OnClickListener(){
                        @Override
                        public void onClick(DialogInterface dialog,int which){
                        }
 
                    }).show();
            }
        });
        Button button1=(Button)findViewById(R.id.login_btn_login);
        button1.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                new AlertDialog.Builder(MainActivity.this).setTitle("系統提示").setMessage("驗證成功!")
                        .setNegativeButton("確定",new DialogInterface.OnClickListener(){
                            @Override
                            public void onClick(DialogInterface dialog,int which){
                            }
                        }).show();
            }
        });
        Button button2=(Button)findViewById(R.id.login_btn_register);
        button2.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                new AlertDialog.Builder(MainActivity.this).setTitle("系統提示").setMessage("註冊成功!")
                        .setNegativeButton("確定",new DialogInterface.OnClickListener(){
                            @Override
                            public void onClick(DialogInterface dialog,int which){
                            }
                        }).show();
            }
        });
    }
}


 以上就是直播系統app原始碼,Android studio 實現app登入註冊頁面, 更多內容歡迎關注之後的文章


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69978258/viewspace-2927882/,如需轉載,請註明出處,否則將追究法律責任。

相關文章