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

熱點內容
一個虛擬主機怎麼建多少網站 瀏覽:825
和家親app為什麼老是掉線 瀏覽:990
兒童編程思維課有什麼用 瀏覽:600
魔百和網路機頂盒怎麼連接電視 瀏覽:611
國產顯示器icc配置文件 瀏覽:52
java編程常見的語法糖有哪些 瀏覽:41
jspmysql選課源碼 瀏覽:877
ipadmini2下載app等待 瀏覽:399
creo工程圖配置文件 瀏覽:699
編程和鋼琴哪個貴 瀏覽:841
移動進銷存app哪個好 瀏覽:600
編程製作游戲什麼原理 瀏覽:97
linux如何查看是否有共享文件夾 瀏覽:264
u盤拷貝文件以後為空 瀏覽:917
快雲主機資料庫連接方法 瀏覽:756
javagsp定位 瀏覽:384
jsp頁面表格導出excel 瀏覽:976
imagetest教程 瀏覽:244
怎樣將一個cad文件包圖紙兼容 瀏覽:898
論文有什麼好的網站 瀏覽:581

友情鏈接