移动端APP设计学习笔记整理:2、写布局与切图常见注意点

声明:本教程不收取任何费用,欢迎转载请注明出处,尊重作者劳动成果,不得用于商业用途,侵权必究!!!

系列博文

移动端APP设计学习笔记整理:1、设计规范-IOS&Android系统

 

1、切底图最好上下左右像素格保持一样

切底图最好上下左右像素格一样长,这样方便代码居中、代码适配

例如,我们要实现登录注册按钮,设计图如下图:

切的底图,在蓝湖上是这样的,上下的像素格不一致

那么我们的 xml 代码实现,如下:

<Button
    android:background="@mipmap/bg_login_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="注册"
    android:textColor="#FFFFFF"
    android:textSize="16sp" />

<Button
    android:background="@mipmap/bg_login_btn"
    android:textColor="#FFFFFF"
    android:textSize="16sp"
    android:text="登录"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

实现的效果,如下图

由于切图上下的像素格,不是一样长的,所以文字不会居中!

 

实现方式1:让 UI 切底图,上下的像素格一样长、左右的像素格一样长

<Button
    android:gravity="center"
    android:background="@mipmap/bg_login_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="注册"
    android:textColor="#FFFFFF"
    android:textSize="16sp" />

<Button
    android:gravity="center"
    android:background="@mipmap/bg_login_btn"
    android:textColor="#FFFFFF"
    android:textSize="16sp"
    android:text="登录"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

 

方式2:根据蓝湖上面的标注,进行实现

<Button
    android:paddingTop="18dp"
    android:paddingBottom="31dp"
    android:background="@mipmap/bg_login_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="注册"
    android:textColor="#FFFFFF"
    android:textSize="16sp" />

<Button
    android:paddingTop="18dp"
    android:paddingBottom="31dp"
    android:background="@mipmap/bg_login_btn"
    android:textColor="#FFFFFF"
    android:textSize="16sp"
    android:text="登录"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>


 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

被开发耽误的大厨

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值