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

    Enhancing the Application: Advanced JDBC Features This chapter describes additional functionality th ...

  2. 王立平--android发育,转让eclipse可选颜色

    android:background="@android:color/white" 版权声明:本文博主原创文章.博客,未经同意不得转载.

  3. Java获得正则表达式

    t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,wid ...

  4. 用golang写的生成文件md5sum,检验文件md5sum

    源代码地址: https://github.com/sndnvaps/md5sum-golang

  5. 为什么tap事件绑定在document上,而不是对象本身上

    1.在移动端前端开发,click事件有300ms的延时,为了提升用户体验,快速响应.zepto添加了tap事件.tap是在手指触屏横纵向移动距离小于30px,触发tap事件.移动距离的判断是通过tou ...

  6. effective c++ 条款6 如果不想要就要告诉大家

    这个条款应该和第五个放在一起 编译器默认生成 1 无参构造函数, 2 析构函数 3 拷贝构造函数 4 赋值预算符 当我们不需要,就要显示的告诉大家我们不需要. 方法:自己声明这个函数为private, ...

  7. Spring的文件上传

    Spring在发现包括multipart的请求后,会使用MultipartResolver的实现bean处理文件上传操作,现有採用Servlet3的 org.springframework.web.m ...

  8. .Net下一个Winform方案可以让MessageBox.Show它显示在父窗口的中间

    下面的文字,缺省值是在屏幕中间显示. DialogResult dr = MessageBox.Show("是否要删除此数据?", "删除确认", Messag ...

  9. Spark里面:获取图Spark有多少行代码

    Spark1.0.0公布一个多月,有多少行代码就(Line of Code, LOC)? watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYW56aHNvZn ...

  10. Velocity脚本新手教程

    从网络下的数据汇编 一.Velocity简介 Velocity它是Apache该公司的开源产品,它是一套基于Java语言模板引擎,背景可以非常灵活的数据与模板文件一起反对.他直言不讳地说:,人使用模板 ...