如今,做网上商店的商品陈列,我想用网络格布局,但总认为空好看。所以我想给它一个净加格线。但是,我遇到了一个问题,网络格布局其实很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. 深挖BAT内部级别和薪资待遇,你敢看?(转)

    一. 阿里内部级别和薪资待遇 先看个例子,或许你也曾像他一样纠结 BAT 的 offer: 最近刚通过阿里面试,但基本薪酬也是不升反小降. 级别只有 P6+,连 P7 都没有,非常郁闷,打算拒绝算了. ...

  2. Linux 下 Error: Could not find or load main class Hello

    在linux下写了一个很easy的Hello world程序,编译执行居然报错:Error: Could not find or load main class Hello 最后发现是CLASSPAT ...

  3. APUE学习总结

    简介 本文总结了个人,一个数字,对应称号<APUE>第一版的每一章,但是,独立的二级标题和书,人需求进行编写. 3.文件I/O 本章所说明的函数常常被称之为不带缓存的I/O(与第5章中说明 ...

  4. Socket通信原理

    对TCP/IP.UDP.Socket编程这些词你不会很陌生吧?随着网络技术的发展,这些词充斥着我们的耳朵.那么我想问: 1.         什么是TCP/IP.UDP?2.         Sock ...

  5. HTML5 Storage API

    原文:HTML5 Storage API Web Storage是HTML5引入的一个非常重要的功能,可以在客户端本地存储数据,类似HTML4的cookie,但可实现功能要比cookie强大的多. 在 ...

  6. xhost和XServer相关概念汇总

    1.xhost 控制什么人可以访问当前主机上的增强 X-Windows.语法:xhost [ + | - ] [ Name ] 2.xhost 是用来控制X server访问权限的.通常当你从host ...

  7. PHP安装mcrypt.so报错 mcrypt.h not found 的解决的方法

    报错内容:configure: error: mcrypt.h not found. Please reinstall libmcrypt 网上搜索了非常多,包含自带的 yum install lib ...

  8. hdu N!

    Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N! Input One N in o ...

  9. makefile知识点归纳的

    以一个样例開始,文件文件夹结构例如以下 ---------(当前文件夹)-----------main.c                   |                   |------- ...

  10. 赵雅智_BroadcastReceiver短信监听

    AndroidManifest.xml 注冊广播接收者 加入权限 <?xml version="1.0" encoding="utf-8"?> &l ...