如今,做网上商店的商品陈列,我想用网络格布局,但总认为空好看。所以我想给它一个净加格线。但是,我遇到了一个问题,网络格布局其实很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"

显示效果例如以下:

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

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

  1. Android GridView 通过seletor 设置状态和默认状态

    Android中可以通过selector控制GridView Item 的状态,而省去使用代码控制 GridView View Selector Xml文件 <?xml version=&quo ...

  2. grid - 通过网格线名称设置网格项目位置

    使用网格线名称设置网格项目位置和使用网格线号码设置网格项目位置类似. 1.引用网格线名称的时候不应该带方括号 <view class="grid"> <view ...

  3. NEON的比较是把所有的bit都设置为1

    NEON中的比较指令,如果结果为true,是把所有的bit都设置为1,而不是设置为1. ushort data1[4] = {129,0,136,255}; uint16x4_t v0 = vld1_ ...

  4. Python用matplotlib绘图网格线的设置

    一.X轴网格线的设置 import matplotlib.pyplot as plt import numpy as np from pylab import mpl mpl.rcParams['fo ...

  5. [Android Pro] listView和GridView的item设置的高度和宽度不起作用

    referece to : http://blog.csdn.net/beibeixiao/article/details/9032569 1.     在Android开发中会发现,有时listVi ...

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

    第一步:在info.plist中添加一个字段:view controller -base status bar 设置为NO 第二步:在一个所有界面都继承的父类里添加: if (IOS7_OR_LATE ...

  7. Gridview中DataKeyNames 设置多个主键 取值

    1.设置DataKeyNames a.F4  在属性面板中设置   多个值以逗号隔开  例如id,mane,sex b.通过后台代码 this.gridview.DataSource = Bind() ...

  8. GridView边线Border设置

    1.黑色实线:(行列都有) <asp:GridViewID="GridView1"runat="server"CellPadding="3&qu ...

  9. Dev中GridControl的GridView 基本样式设置

    基本样式图: 代码如下: /// <summary> /// gridView样式 /// </summary> /// <param name="gdv&qu ...

随机推荐

  1. Red Gate系列之三 SQL Server 开发利器 SQL Prompt 5.3.4.1 Edition T-SQL智能感知分析器 完全破解+使用教程

    原文:Red Gate系列之三 SQL Server 开发利器 SQL Prompt 5.3.4.1 Edition T-SQL智能感知分析器 完全破解+使用教程 Red Gate系列之三 SQL S ...

  2. 【原创】poj ----- 1611 The Suspects 解题报告

    题目地址: http://poj.org/problem?id=1611 题目内容: The Suspects Time Limit: 1000MS   Memory Limit: 20000K To ...

  3. WPF 3D: MeshGeometry3D纹理坐标的正确定义

    原文 WPF 3D: MeshGeometry3D纹理坐标的正确定义 为了使基于2D的纹理显示在3D对象中,我们必须定义3D Mesh对象的纹理贴图坐标.在WPF中,此项功能则通过MeshGeomet ...

  4. FastDFS源代码分析之tracker协议分析

    本篇博客主要解说fastdfs中tracker协议的解说. fastdfs主要是存储文件.直接把整个文件存储到磁盘上,所以.简单直接.可是也有非常大的局限性. 因此,fastdfs对文件的文件夹设置和 ...

  5. php zip文件内容比較类

    php zip 文件比較类,比較两个zip文件的内容,返回新增,删除,及同样的文件列表.临时仅仅支持单层. 需求:上传一个zip文件,zip内有非常多图片文件.须要对图片文件进行一系列非常耗时的处理. ...

  6. 数据结构之计算器的实现(JAVA)(四)

    原理: 1.将中序表达式变化兴许表达式 2.当前字符为数字,将该数字放入栈中 3.当前字符为操作符,从栈中取出两个树,依据操作符来运算,将运算结果放入到栈中 4.反复,直到将字符操作完.此时栈中仅仅剩 ...

  7. 网站通常使用一些javascript包裹 简化电话

    //对于Web地址参数 //前面加"=="进行标识,否则直接返回 //解码时依据是否含有"=="标识来决定是否要解码 var base64EncodeChars ...

  8. [webapi] 如何在查看api时 显示api的说明

    首先在Controller的方法中 写上相关注释,如下图 然后 右击webapi项目点属性.按照下图选择 红色框中内容要保持一致 然后保存. 在项目中找到到这个文件Areas/HelpPage/App ...

  9. RunJS推荐用于个人使用(使用方便JS、css实时预览、编辑、管理等功能)

    RunJS,在线编写.展示html.js.css代码,拥有实时预览.分享.Fork.代码高亮.自己主动完毕等多项特性,提供文件上传.多种登录方式. 地址:http://runjs.cn/ waterm ...

  10. bash构造tmux显示tmux ssh状态

    要求: 于tmux内部链接ssh什么时候, 假设有多个ssh主机. 我们要显示相应的主机ip要显示筛查 实现效果 编辑你的bashrc, 由于我习惯在root下操作, 所以/root/.bashrc. ...