• 04_登陆案例布局实现


    第一步:画UI。第二步:对UI敲Java代码,然后给它部署到设备上。

    有一个勾选框判断这个东西是否勾上了,如果勾上了,把用户名和密码保存起来。网站和论坛经常都会有这样的选项。是否记住用户名和密码,你如果勾上了咱们就把用户名和密码通过文件的形式存到本地。

    判断用户名和密码是否为空,如果不为空,就判断这个框是否勾上了。如果勾上了就把用户名和密码存起来。

    可能在你的公司整个项目的业务逻辑是你的项目经理/产品经理去定的。人家让你怎么做你就按照这个逻辑来。

    第一步:画UI.不能用拖控件的这种方式去画UI界面了.

    可以搞嵌套。上面一个竖直方向的线性布局。然后我再嵌套一个水平方向的线性布局或者是一个相对布局。或者说整个布局就用相对布局去做。相对布局比较灵活。ADT默认创建的就是相对布局。

    用户名输入框的警告是国际化的。

    [I18N] Hardcoded string "请输入用户名", should use @string resource

    密码输入框的警告是提示要增加多一个属性textPassword

    The view name (@+id/et_password) suggests this is a password, but it does not include 
     'textPassword' in the inputType
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        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=".MainActivity" >
    
        <EditText android:id="@+id/et_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="请输入用户名"/>
         <EditText 
             android:id="@+id/et_password"
             android:layout_below="@id/et_username"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:inputType="textPassword"
             android:hint="请输入密码"/>
         <CheckBox
             android:id="@+id/cb_isSave"
             android:layout_below="@id/et_password"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="勾选保存信息"/>
         <Button
             android:id="@+id/btn_login"
             android:layout_below="@id/cb_isSave"
             android:layout_alignParentRight="true"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="登陆"
             />
    </RelativeLayout>

  • 相关阅读:
    Xaml引用图片路径的方式
    并发概念模型:JMM(JAVA内存模型)
    并发组件之一:ThreadLocal线程本地变量
    并发锁之二:ReentrantReadWriteLock读写锁
    并发锁之一:ReentrantLock重入锁
    AQS同步队列器之二:等待通知机制
    AQS同步队列器之一:使用和原理
    css常用操作
    自动生成mybatis代码
    jdk动态代理源码分析(二)---依赖接口的实现
  • 原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/7003351.html
Copyright © 2020-2023  润新知