Android 背景透明度设置和设置GridView元素间距
16lz
2021-01-23
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简单实现更换桌面背景的方法
- Android阴影背景
- Android 中的ListView选中项的背景颜色怎么设置?
- android app界面背景替换
- Android通过点击按钮改变Activity的背景颜色_个人笔记
- Android中改变Dialog背景透明度