導航:首頁 > 編程語言 > 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登陸程序相關的資料

熱點內容
怎麼休改文件名 瀏覽:989
cdr導出圖片不顯示文件名 瀏覽:761
pcdmis如何離線編程 瀏覽:201
微信推文插入文件 瀏覽:844
生產文件櫃圖片 瀏覽:244
如何設置微信數據增加 瀏覽:95
excel文件不再增大 瀏覽:613
ug編程刀路怎麼復制不用滑鼠選取 瀏覽:97
excel文件打開擴展名錯誤 瀏覽:10
阿里巴巴怎麼做數據包 瀏覽:442
無線網路連接一直顯示未連接 瀏覽:25
windows7如何自動激活工具下載 瀏覽:57
天語救磚工具 瀏覽:839
網路體育課程有哪些 瀏覽:19
蘋果微信怎麼查看文件 瀏覽:165
安卓nba2k14面補替換 瀏覽:450
路由器密碼定時換 瀏覽:626
aicc恢復文件在哪裡 瀏覽:167
怎麼查無線網路屬性 瀏覽:874
只狼的聲音文件放在哪裡 瀏覽:219

友情鏈接