zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    【算法18】重排数组元素使得所有的奇数位于所有偶数之前
    php函数ob_start()、ob_end_clean()、ob_get_contents()
    php代码调试
    判断文件存在是用file_exists 还是 is_file
    ubuntu屏幕截图工具:scrot,可截鼠标拖曳的矩形区域图形
    mysql常用的技巧
    用户角色权限设计
    解决ubuntu耳机和音箱同时发音
    SSH免密码登录
    IE, Firefox下,checkbox的钩钩一旦勾上,画面再刷新,钩钩还是勾上的解决方案
  • 原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/7003351.html
Copyright © 2011-2022 走看看