Android(安卓)背景透明度设置和设置GridView元素间距
16lz
2021-12-24
Android 背景透明度设置和设置GridView元素间距
- 一、设置背景透明度
- 二、设置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>
设置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%透明度
如果像设置其他透明度可以参考以下
100% — #FF00000095% — #F200000090% — #E600000085% — #D900000080% — #CC00000075% — #BF00000070% — #B300000065% — #A600000060% — #9900000055% — #8C00000050% — #8000000045% — #7300000040% — #6600000035% — #5900000030% — #4D00000025% — #4000000020% — #3300000015% — #2600000010% — #1A0000005% — #0D0000000% — #00000000
二、设置GridView 元素间距
android:verticalSpacing=“15dp”//设置每行之间的间距
android:horizontalSpacing=“15dp”//设置每列之间的间距
比如 android:verticalSpacing=“15dp” 设置行距15dp
更多相关文章
- Android——TextView属性XML详解
- android颜色关于Android(安卓)TabHost切换Tab字体的颜色背景颜色
- 用Fiddler抓取Android、Iphone网络数据包
- Android完美解决输入框EditText隐藏密码打勾显示密码问题
- Shape Drawable的学习
- android TextView属性的详细介绍 分享
- Android(安卓)Studio设置 标题栏隐藏, 状态栏隐藏, 改变状态栏文
- 按钮状态选择(选中,取消)
- Android—TextView的XML属性和方法