/* --- 数据行绑定 --- */
protected void XXX_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
/* --- 数据行为第五(倍数)或者第六(倍数)的时候 --- */
if (e.Row.RowIndex != 0 &&(e.Row.RowIndex % 4 == 0 || e.Row.RowIndex % 5 == 0))
{
foreach (TableCell cell in e.Row.Cells)
{
/* --- 添加样式 --- */
cell.Attributes.Add("style", e.Row.RowIndex % 4 == 0 ? "padding-bottom:15pxborder-bottom:solid 1px Gray" : "padding-top:15px")
}
}
}
}
找了个方法 item布局这样试试<? xml version= "1.0" encoding= "utf-8" ?>
<LinearLayout xmlns:android= "url/apk/res/android"
android:layout_width= "match_parent"
android:layout_height= "match_parent"
android:background= "#c4c4c4"
android:orientation= "vertical"
android:padding= "1px" >
<LinearLayout
android:layout_width= "fill_parent"
android:layout_height= "fill_parent"
android:background= "@color/white"
android:gravity= "center"
android:orientation= "vertical" >
<ImageView
android:id= "@+id/homegriditem_iv"
android:layout_width= "100dp"
android:layout_height= "100dp"
android:src= "@drawable/ic_launcher" />
<TextView
android:id= "@+id/homegriditem_tv"
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:text ="xxx" />
</LinearLayout >
</ LinearLayout>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)