GridView网格线都设置

如今,做网上商店的商品陈列,我想用网络格布局,但总认为空好看。所以我想给它一个净加格线。但是,我遇到了一个问题,网络格布局其实很easy,是集GridView布局和背景颜色adapter布局设置背景颜色参考。

我的设置,如以下:

1
2
3
4
5
6
7
8
9

<GridView

android:id="@+id/gv_group"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="#DCDCDC"

android:horizontalSpacing="1dp"

android:numColumns="2"

android:stretchMode="columnWidth"

android:verticalSpacing="1dp" />

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

<?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="wrap_content"

android:background="@android:color/white"

android:padding="3dp" >

<RelativeLayout

android:id="@+id/rl_group"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical" >

<ImageView

android:id="@+id/iv_group_image"

android:layout_width="160dp"

android:layout_height="90dp"

android:layout_centerHorizontal="true"

android:contentDescription="@string/No"

android:scaleType="fitXY" />

<TextView

android:id="@+id/tv_group_desp"

android:layout_width="160dp"

android:layout_height="wrap_content"

android:layout_alignLeft="@id/iv_group_image"

android:layout_below="@id/iv_group_image"

android:layout_marginTop="2dp"

android:ellipsize="end"

android:gravity="center_vertical"

android:lines="2"

android:text="海尔1.5匹无氟冷暖变频挂壁式空调"

android:textSize="14sp" />

<LinearLayout

android:id="@+id/ll_price"

android:layout_width="160dp"

android:layout_height="wrap_content"

android:layout_alignLeft="@id/tv_group_desp"

android:layout_below="@id/tv_group_desp"

android:layout_marginTop="3dp"

android:orientation="horizontal" >

<TextView

android:id="@+id/tv_group_price"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="¥32"

android:textColor="@color/red"

android:textSize="16sp" />

<TextView

android:id="@+id/tv_group_delete"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="8dp"

android:text="¥21"

android:textColor="@android:color/darker_gray"

android:textSize="12sp" />

</LinearLayout>

<LinearLayout

android:layout_width="160dp"

android:layout_height="wrap_content"

android:layout_alignLeft="@id/ll_price"

android:layout_below="@id/ll_price"

android:orientation="horizontal" >

<TextView

android:id="@+id/tv_group_discount"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:ellipsize="end"

android:singleLine="true"

android:text="2.0折"

android:textColor="#ffff2e2e"

android:textSize="12sp" />

<TextView

android:id="@+id/tv_group_sell"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="8dp"

android:ellipsize="end"

android:singleLine="true"

android:text="0件已被购买"

android:textColor="@android:color/darker_gray"

android:textSize="12sp" />

</LinearLayout>

</RelativeLayout>

</LinearLayout>

显示的结果是这种:

四边被我圈起来了,有木有认为非常难看?反正我是认为难看。这可纠结了,最后最终找到解决的方法了,so easy...就是在GridView布局中加入这样一个属性:

android:listSelector="@null"

显示效果例如以下:

怎么样?这不是很值得称道?

时间: 2024-08-09 00:08:40

GridView网格线都设置的相关文章

GridView网格线设置

今天在做网上商城的商品显示,想用网格布局,可是总觉得空空的不好看,所以就想着给它加个网格线,可是遇到问题了,网格布局其实很简单,就是设置GridView布局的背景色和adapter引用的布局设背景色.我的设置如下: 1 2 3 4 5 6 7 8 9 <GridView android:id="@+id/gv_group" android:layout_width="match_parent" android:layout_height="wrap_

Gridview表格边框设置

GridView在生成HTML代码的时候会自动加上style="border-collapse:collapse;"以及border=1,rules="all"这些属性,这些在IE下都没什么影响,但是在FF下就会影响显示,style="border-collapse:collapse;":是由于设置了CellSpacing="0"产生的,当设置CellSpacing="1"后就没有,可以去掉style=&q

GridView中超链接设置

<%# Eval("id") %>Bind方式    <%# Bind("id","~/info.aspx?id={0}") %> 推荐使用第一种方式,可以在一个<%# %>里放入多个绑定,而第二种只能如此绑定一个值<%# Eval("id") + ":" + Eval("name")%> 做超级链接的控件,我们也有多种选择:1 asp:L

提高myEclipse的开发效率和外观,这些你都设置了吗?

[前言] 为什么我的myeclipse开启速度那么慢,为什么别人能哗啦啦几个快捷键打出一片代码?刚开始使用myeclipse的时候,相信大家都有这个疑问,慢慢的,也懂得一些配置,我也不例外,在此,把常用的配置做下随笔,方便查阅. [外观篇] 一.改变字体 Window-->preference-->general-->appearance-->colors and fonts-->这里有各个编译环境的字体的设置. 二.改变编辑界面的背景 下载主题:theme-1.epf   

DevExpress GridView 添加和设置右键菜单

右键菜单肯定是GridView中经常要使用的一个功能.本文主要描述三个方面:1.如何在GridView中添加右键菜单2.如何设置菜单是否可用(enable) 3.如何获取右键点击事件 一.添加右键菜单1.在VS工具箱中的"菜单和工具栏"找到ContextMenuStrip控件,双击添加. 2.点击ContextMenuStrip右上方的小三角形,打开编辑项,可以添加菜单项. 3.选择gridControl(注意这里不是gridView的属性),在属性中可以找到ContextMenuSt

iOS如何把所有界面的状态栏的字体颜色都设置为白色

第一步:在info.plist中添加一个字段:view controller -base status bar 设置为NO 第二步:在一个所有界面都继承的父类里添加: if (IOS7_OR_LATER) { // 判断是否是IOS7 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO]; }

iOS如何把所有页面状态栏的字体颜色都设置为白色

第一步:在info.plist中添加一个字段:view controller -base status bar 设置为NO 第二步:在一个所有界面都继承的父类里添加: if (IOS7_OR_LATER) { // 判断是否是IOS7 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO]; }

mvc5怎么给所有action都设置几个公用的ViewBag

最近开发项目中遇到这样的问题,因为有多个同步的页面,所以需要在多个同步页面上有相同的值返回回来,经过一系列的思维,我们把思维整理出来. public ActionResult Index() { ViewBag.RootURL = “11111”; ViewBag.ToolWebSite = “2222”; return View(); } public ActionResult Create() { ViewBag.RootURL = “11111”; ViewBag.ToolWebSite

打开文件提示“已被macos使用“,不用每次都设置一遍

macos系统打开移动硬盘的视频时,提示“已被macOS使用”,按照查找的方法设置,用编辑命令行的方式,可以成功,但是下一次再次访问硬盘时,同一个文件同样的问题又再次出现.所以找了一次性解决的问题. os版本 10.15 完整步骤: 1.创建自动操作 Automator--服务--选定:文件或文件价:位于:Finder 2.配置整个自动化流程 a.创建请求确认,避免错误点击 b.创建路径变量 1)创建变量,输入参数 2)获得变量的值 3.运行shell脚本,输入以下代码 read -p "inp