zoukankan      html  css  js  c++  java
  • 安卓界面控件屏幕居中Layout例子

    经典的登录界面例子:

    <?xml version="1.0" encoding="utf-8"?>

    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity = "center"
    >
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity = "center"
    >
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:textSize="16sp"
    android:text="用户:"
    android:layout_width="80dp"
    android:layout_height="wrap_content" />

    <EditText
    android:layout_width="245dp"
    android:layout_height="wrap_content"
    android:imeActionId="@+id/login"
    android:inputType="textPassword"
    android:maxLines="1"
    android:singleLine="true"
    android:layout_gravity="center_horizontal|bottom" />
    </LinearLayout>
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity = "center"
    >
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:textSize="16sp"
    android:text="密码:"
    android:layout_width="80dp"
    android:layout_height="wrap_content" />

    <EditText
    android:id="@+id/password"
    android:layout_width="245dp"
    android:layout_height="wrap_content"
    android:inputType="textPassword"
    android:singleLine="true"
    android:layout_gravity="center_horizontal|bottom" />
    </LinearLayout>

    <Space
    android:layout_width="match_parent"
    android:layout_height="20dp"
    android:layout_gravity="center_horizontal" />

    <Button android:text="登录"
    android:layout_width="120dp"
    android:layout_height="wrap_content" />

    </LinearLayout>

  • 相关阅读:
    jenkins自动化部署前端项目
    jenkins自动部署java项目
    Jenkins插件修改为国内源
    jenkins搭建以及初始化
    gitlab-ci集成sonarqube完成代码检测
    微信小程序模板消息后端代码
    解决上传图片到服务器 水印文字显示框框不显示文字的问题
    ES transport client使用
    签发的用户认证token超时刷新策略
    api权限管理系统与前后端分离实践
  • 原文地址:https://www.cnblogs.com/legahero/p/Layout.html
Copyright © 2011-2022 走看看