总结 2017-12-07

第一次做工作总结不知怎么去写我就简单把这两天正着手做老师布置的UI作业制作方法介绍一下 

作业的图片如下:


图一:我运用的是线性布局:

设计步骤如下:

1.首先为整体创建一个线性布局

2.开始逐一编辑每一行的内容,我先介绍一下  “意见反馈”  这一行的实现方法,创建一个线性布局,我设定宽度为屏幕宽度,高度为50dp,设定这个线性布局的颜色为白色即#fffffff,然后设定这个布局与上一个布局留出一个高度1dp,为什么要设定颜色和距离上一个布局的高度呢,因为仔细看图片有一个细小的分割线,便于应用的使用,所以我们可以使用这个方法进行简单的分割,如果对线的颜色有要求的话,可以在两个布局之间创建一个文本,文本颜色调为制定的颜色,高度细小就可以了。

3.添加两个控件,文本框和图片框,设置一个文本框输入需要显示的文本内容,设定文本与左侧边框的宽度用PaddingLeft,(外边距则用marginLeft)输入指定的宽度就行。使文本框内容水平居中用layout_gravity="center"

4.图片框,先导入给的资源图片,在drawable中,  代码用src调用即可,android:layout_gravity="center" 设定图片居中。

5.发现两个控件的比例不协调怎么办呢,我使用的是线性布局中调试组件之间布局比较方便的权重,在线性布局中设置权重为10,令文本框占大量,图片框占小数,这样就能实现组件与组件之间的位置分别占用这个线性布局的比例,我设定的是 8:2比例,在此需要注意的是,因为权重比,所以我们的文本框和图片框的宽度都需要设定为0dp,而且高度统一为自适应宽度。

6.“修改密码,关于我们” 复制上面的代码即可实现

7.按钮比较简单,直接创建按钮组件设置文本,调整宽度高度距离屏幕边框的距离即可


下面代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="10"

    >


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="#ffffff"

        >

        <ImageView

            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="2"
            android:src="@drawable/back" />

        <TextView
            android:layout_width="0dp"
            android:layout_gravity="center"
            android:layout_height="wrap_content"
            android:layout_weight="8"

            />

    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="1dp"
        android:background="#ffffff">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="9"
            android:layout_gravity="center"
            android:paddingLeft="20dp"
            android:text="消息推送"
            android:textSize="20dp" />


        <CheckBox
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            android:layout_gravity="center"
            android:button="@drawable/state_checked"
            android:checked="true"

            />


    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="1dp"
        android:background="#ffffff">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="9"
            android:layout_gravity="center"
            android:paddingLeft="20dp"
            android:text="意见反馈"
            android:textSize="20dp" />


        <ImageView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:src="@drawable/set_arrow"

            />


    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="1dp"
        android:background="#ffffff">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="9"
            android:layout_gravity="center"
            android:paddingLeft="20dp"
            android:text="修改密码"
            android:textSize="20dp" />


        <ImageView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:src="@drawable/set_arrow"

            />


    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="1dp"
        android:background="#ffffff">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="9"
            android:layout_gravity="center"
            android:paddingLeft="20dp"
            android:text="关于我们"
            android:textSize="20dp" />


        <ImageView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:src="@drawable/set_arrow"

            />
    </LinearLayout>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="30dp"
        android:background="#ffffff"
        android:text="退出账号"
        android:textColor="#FFE60F0F"
        android:textSize="20sp" />


</LinearLayout>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值