Android 背景透明度设置和设置GridView元素间距

Android 背景透明度设置和设置GridView元素间距

一、设置背景透明度

Android开发过程中经常使用背景,有时候为了使按钮或者是GridView的元素更加明显,需要设置背景透明度。
比如设置10%的背景透明度:android:background="#1A000000"


RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#1A000000">// 设置背景透明度。
</RelativeLayout>

10%透明度
设置60%透明度

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#99000000">//60%透明度

60%透明度
如果像设置其他透明度可以参考以下

100% — #FF000000
95% — #F2000000
90% — #E6000000
85% — #D9000000
80% — #CC000000
75% — #BF000000
70% — #B3000000
65% — #A6000000
60% — #99000000
55% — #8C000000
50% — #80000000
45% — #73000000
40% — #66000000
35% — #59000000
30% — #4D000000
25% — #40000000
20% — #33000000
15% — #26000000
10% — #1A000000
5%  — #0D000000
0%  — #00000000

二、设置GridView 元素间距

android:verticalSpacing=“15dp”//设置每行之间的间距
android:horizontalSpacing=“15dp”//设置每列之间的间距

比如 android:verticalSpacing=“15dp” 设置行距15dp
GridView行距

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值