导航:首页 > 编程语言 > 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登陆程序相关的资料

热点内容
图片传入iphone 浏览:730
rs485双机通信程序 浏览:967
怎么托日本的朋友买苹果手机 浏览:145
筑业电力软件怎么倒出文件 浏览:572
全民飞机大战军衔怎么升级 浏览:431
公司自动化编程属于什么 浏览:925
位位用车app在哪里下载 浏览:427
格式工厂iphone铃声 浏览:171
linux设置字符编码 浏览:15
帝王世纪升级哪个兵种 浏览:409
c编程开发软件是什么 浏览:334
二的大写怎么写app 浏览:612
乐视数据删除了怎么找回来 浏览:651
ug编程初始化怎么办 浏览:295
nginxajax配置文件 浏览:467
小程序获取二进制图片 浏览:206
为什么有的数控车编程有百分号 浏览:425
m文件有什么用 浏览:359
宜昌做投标文件多少钱 浏览:166
uc浏览器小说下载那个文件夹 浏览:908

友情链接