導航:首頁 > 編程語言 > android登陸程序

android登陸程序

發布時間:2023-09-03 21:28:28

Ⅰ 如何使用Android Studio開發用戶登錄界面

java">activity_register.xml:
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayoutxmlns:android="

xmlns:tools="

android:id="@+id/activity_redister"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.weijun.test0321.RegisterActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用戶名:"
android:textSize="25sp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/please_input_user_name"
android:id="@+id/input_user_name"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密碼:"
android:textSize="25sp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="請輸入密碼"
android:id="@+id/input_user_password"
/>
</LinearLayout>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/rg">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="男"
android:id="@+id/boy"
android:layout_weight="1"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="女"
android:layout_weight="1"
android:id="@+id/girl"
/>
</RadioGroup>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注冊"
android:id="@+id/bn_register"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
</LinearLayout>
activity_login.xml:
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayoutxmlns:android="

android:orientation="vertical"android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="登陸界面"
android:textSize="38sp"
/>
</RelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用戶名:"
android:textSize="25sp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/user_name"
/>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密碼:"
android:textSize="25sp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/user_password"
/>
</LinearLayout>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="記住密碼?"
android:id="@+id/remember_password"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登陸"
android:id="@+id/bn_login"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_register"
android:text="注冊賬號"
android:layout_alignParentBottom="true"
android:textColor="@color/colorAccent"
/>

</RelativeLayout>
</LinearLayout>

MyOpenHelper.java:

{
publicMyOpenHelper(Contextcontext){
super(context,"info.db",null,1);
}

@Override
publicvoidonCreate(SQLiteDatabasedb){
db.execSQL("createtableinfo(_,namevarchar(20),passwordvarchar(20),sexvarchar(20))");
}

@Override
publicvoidonUpgrade(SQLiteDatabasedb,intoldVersion,intnewVersion){

}
}

registerActivity.java:

{
privateEditTextet_name,et_password;
privateRadioGrouprg;
privateButtonbn_register;
;
privateSQLiteDatabasedatabase;
privateCheckBoxcb_remember_password;
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);

initUI();
initListener();
}

privatevoidinitListener(){
bn_register.setOnClickListener(newView.OnClickListener(){
@Override
publicvoidonClick(Viewv){
Stringget_name=et_name.getText().toString().trim();
Stringget_password=et_password.getText().toString().trim();
if(TextUtils.isEmpty(get_name)||TextUtils.isEmpty(get_password)){
Toast.makeText(RegisterActivity.this,"請輸入用戶名或密碼",Toast.LENGTH_SHORT).show();
}else{
inttemp=rg.getCheckedRadioButtonId();
intsex=0;
switch(temp){
caseR.id.boy:
sex=1;
break;
caseR.id.girl:
sex=2;
break;
}
if(sex==0){
Toast.makeText(RegisterActivity.this,"請選擇性別",Toast.LENGTH_SHORT).show();
}elseif(sex==1){
myOpenHelper=newMyOpenHelper(RegisterActivity.this);
database=myOpenHelper.getReadableDatabase();
ContentValuesvalues=newContentValues();
values.put("name",get_name);
values.put("password",get_password);
values.put("sex","男");
database.insert("info",null,values);
}else{
myOpenHelper=newMyOpenHelper(RegisterActivity.this);
database=myOpenHelper.getReadableDatabase();
ContentValuesvalues=newContentValues();
values.put("name",get_name);
values.put("password",get_password);
values.put("sex","女");
database.insert("info",null,values);
}
}
}
});
}

privatevoidinitUI(){
et_name=(EditText)findViewById(R.id.input_user_name);
et_password=(EditText)findViewById(R.id.input_user_password);
rg=(RadioGroup)findViewById(R.id.rg);
bn_register=(Button)findViewById(R.id.bn_register);

}
}

loginActivity.java貼不上來,超過字數了。

Ⅱ 編寫一個Android應用程序,模擬系統登錄界面效果。

額,這位同學,我不是很想打擊你,有總很快捷的方式寫出這個。

我列舉幾個方法來實現這個功能。

  1. 網路上很多例子而且效果和你那個一個樣,搜索的關鍵字是(android 登錄界面實現)

  2. 利用android studio自帶的工具實現登錄界面的編寫

請看下面截圖實現

Ⅲ 請問安卓手機用谷歌帳號登錄,需要什麼程序安卓手機能用谷歌登錄嗎

需要「谷歌套件(GooglePlay/GooglePlay服務/Google服務框架/Google賬戶管理器)」,國行機通常不會預裝;可以自行刷入,步驟如下:下載Google套件後先將它們安裝到手機,用幸運破解器(需下載)移動至「System/app」系統分區後重啟系統。

閱讀全文

與android登陸程序相關的資料

熱點內容
除了編程還有什麼技術 瀏覽:64
為什麼程序員討厭中文編程 瀏覽:338
數控車床編程g40是什麼意思 瀏覽:782
人們花錢為什麼逐漸網路化 瀏覽:272
如何用編程辦理電信業務 瀏覽:189
數控磨床小圓弧怎麼編程 瀏覽:390
桐鄉編程貓在哪裡 瀏覽:69
同一文件夾存儲大量文件 瀏覽:126
chrome修改js 瀏覽:842
用pad怎麼發word文件怎麼打開 瀏覽:465
哪個網站有幼 瀏覽:299
航班APP哪個最好 瀏覽:590
網路原創如何增強教育活力 瀏覽:527
蘋果第三方打開文件 瀏覽:310
蘋果電腦桌面移除的文件夾怎麼恢復 瀏覽:292
在文件名前添加字元 瀏覽:424
javaexcel導出控制項 瀏覽:484
怎麼樣粉碎文件 瀏覽:798
谷歌網站怎麼更新 瀏覽:934
svn命令行刪除文件夾 瀏覽:277

友情鏈接