Android开发实践(五)App的登陆界面

这篇博客讲述了如何在Android应用中创建登录界面,并实现登录功能。通过布局设计设置用户名、密码输入框和登录按钮,然后在按钮点击事件中获取输入信息,向服务器发送请求。如果登录成功,将信息保存在SharedPreferences中,以便后续自动登录。
摘要由CSDN通过智能技术生成

首先,在布局页面一顿乱画,把名字密码和登陆按钮贴上去,背景图布局什么的都不说了,直接贴下面代码可能为引发一些图片找不到之类的错误,敬请留意

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/login"
    android:id="@+id/main"> 
     <ImageView
          android:id="@+id/imageView1"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"  
          android:background="#f00"
          android:src="@drawable/logo" 
          android:contentDescription="@null"/> 
          
    <RelativeLayout
        android:id="@+id/container"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@id/imageView1" >
 
        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="40dp"
            android:layout_height="40dp"  
            android:layout_marginTop="50dp"
             android:layout_marginLeft="20dp"
            android:src="@drawable/loginicon1" 
            android:contentDescription="@null"/>

        <EditText
            android:id="@+id/editText1"
            android:layout_width="250dp"
            android:layout_height="wrap_content"
            android:layout_toRightOf  ="@+id/imageView2" 
            android:layout_alignBottom  ="@+id/imageView2" 
            android:ems="10"  
            android:hint="@null"> 
            <requestFocus />
        </EditText>

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="40dp"
            android:layout_height="40dp"  
            android:layout_alignRight="@+id/imageView2"
            android:layout_below=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值