• andorid之UI


    位置分区

    控制控件的行为的方式:

    1.xml文件

    2.使用set方法

    ui设计就是在viewgroup中添加。

    button和editview继承自textview

    textview继承自view

    注意根布局的设置

    颜色代码表http://blog.csdn.net/u014096171/article/details/52400956

    附上xml文件:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.administrator.ui1.MainActivity">


    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background="#E6E6FA"
    tools:layout_editor_absoluteX="8dp"
    tools:layout_editor_absoluteY="8dp">
    <ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/more"
    android:layout_marginRight="303dp"
    android:layout_marginEnd="303dp"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="小米账号登陆"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:textSize="25dp"
    android:textColor="#00F"/>
    <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="注册"
    android:layout_alignParentRight="true"
    android:background="@null"
    />
    </RelativeLayout>
    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp">
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="账号"
    android:layout_marginLeft="20dp"
    android:textSize="20dp"
    />
    <EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="请输入账号"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="20dp"
    />
    </LinearLayout>

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="密码"
    android:layout_marginLeft="20dp"
    android:textSize="20dp"
    />
    <EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="请输入密码"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="20dp"
    android:inputType="textPassword"
    />

    </LinearLayout>

    <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="登陆"
    android:layout_marginLeft="150dp"
    android:layout_marginTop="20dp"
    android:background="#E6E6FA"
    />
    </LinearLayout>

  • 相关阅读:
    记一次VS2010和VS2015自定义颜色的过程
    Git使用笔记
    VS winsock.h和ws2def.h大量重定义报错的问题
    在ASP.NET MVC 3中使用日志记录组件Elmah和NLog
    Entity Framework 6新特性:全局性地自定义Code First约定
    在ASP.NET MVC 3 中自定义AuthorizeAttribute时需要注意的页面缓存问题
    SSH开发记录
    iOS开发知识要点
    (收藏)在 iPhone/iPad 中随意修改数字键盘按钮
    iPhone开发 – 数据持久化
  • 原文地址:https://www.cnblogs.com/fyz666/p/6537776.html
Copyright © 2020-2023  润新知