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

    也许你早已注意到,我们在介绍软件的时候,在安装这块一般都提供 PPA 源安装方式,这是一种快速方便的软件安装方法,但对于一些新手来说,对 PPA 并不是很熟悉,下面我们就详细介绍一下. # 我们先了解 ...

  2. Google Maps Android API v2 (4)- 地图类型

    地图类型 地图内的谷歌地图的Android API的种类有很多.地图的类型管辖地图的整体代表性.例如,地图集通常包含政治地图,专注于显示边界和道路地图,显示了一个城市或地区的所有道路. Android ...

  3. 新浪微博id的62进制转换

    某条微博链接 某条微博的链接如下,同样省略了后面的无关参数 http://weibo.com/2803301701/CeaOU15IT CeaOU15IT为这条微博的mid,与之相对应的还有一个id, ...

  4. Leetcode:minimum_depth_of_binary_tree解决问题的方法

    一.     称号 并寻求最深的二元相似.给定的二进制树.求其最小深度. 最小深度是沿从根节点,到叶节点最短的路径. 二.     分析 当我看到这个题目时.我直接将最深二叉树的代码略微改了下,把ma ...

  5. 一份关于jvm内存调优及原理的学习笔记

    JVM 一.虚拟机的基本结构 1.jvm整体架构 类加载子系统:负责从文件系统或者网络中加载class信息,存入方法区中. 方法区(Perm):存放加载后的class信息,包括静态方法,jdk1.6以 ...

  6. Android - 支持不同的设备 - 支持不同的屏幕

    Android整体上按照两大类来分类设备屏幕:尺寸和分辨率.app在设备上运行应该考虑大小和分辨率.同样的,你应该包含不同的资源来让app适应不同的屏幕大小和分辨率. 整体上有四种尺寸:小的,正常的, ...

  7. 文章之间的基本总结:Activity生命周期

    孔子:温故而知新.它可以作为一个教师.<论语> 同样的学习技巧.对于技术文件或书籍的经典技术,期待再次看到它完全掌握,这基本上是不可能的,所以,我们常常回来几次,然后仔细研究,为了理解作者 ...

  8. C# 经典排序算法大全

    C# 经典排序算法大全 选择排序 using System; using System.Collections.Generic; using System.Linq; using System.Tex ...

  9. Swift和C#的基本语法对比

    Recently, Apple announced and released a beta version of the new Swift programming language for buil ...

  10. 2.Cocos2dx 3.2重力系统Box2D

     1 加入Box2D相关的库 步骤1:右击项目所在的解决方式à加入->现有项目àE:\Installed\cocos2d-x-3.2\cocos2d-x-3.2\external\Box2D ...