columnspan

columnspan 是 HTML 语言中的一个属性,它可以让一个表格单元格(td)跨越多列。举个例子,如果你想让一个表格单元格占据整个表格的宽度,你可以使用 columnspan="4"(如果表格有四列)。这样,该表格单元格就会跨越四列,占据整个表格的宽度。

使用方法如下:

<table>
  <tr>
    <td columnspan="4">这是一个跨越 4 列的表格单元格</td>
  </tr>
</table>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用ListView实现的GridView效果,其中每个子元素可以设置自己的占位,比如当前元素占几行几列(rowSpancolumnSpan),所以看起来就像一个不规则的随机的网格布局。项目地址:https://github.com/felipecsl/AsymmetricGridView 效果图:使用说明:xml<com.felipecsl.asymmetricgridview.library.widget.AsymmetricGridView     xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@ id/listView"     android:layout_width="match_parent"     android:layout_height="match_parent"/>activity中:@Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_main);     listView = (AsymmetricGridView) findViewById(R.id.listView);     // Choose your own preferred column width     listView.setRequestedColumnWidth(Utils.dpToPx(this, 120));     final List<AsymmetricItem> items = new ArrayList<>();     // initialize your items array     adapter = new ListAdapter(this, listView, items);     listView.setAdapter(adapter); }支持追加更多的元素:// Will append more items at the end of the adapter. listView.getAdapter().appendItems(moreItems); // resetting the adapter items. Will clear the adapter // and add the new items. listView.getAdapter().setItems(items);设置是否重新排列达到更好的显示效果:// Setting to true will move items up and down to better use the space // Defaults to false. listView.setAllowReordering(true); listView.isAllowReordering(); // true设置item的占位:item 一般这样定义:public DemoItem(final int columnSpan, final int rowSpan, int position) {     this.columnSpan = columnSpan;     this.rowSpan = rowSpan;     this.position = position; }columnSpan 和rowSpan分别代表列占位和行占位。说明:目前当item的rowSpan = 2 columnSpan = 2时可以达到最佳的状态。这个后续会继续改进。item的大小越统一,效率越高,特殊大小的元素少于20%是比较理想的状态。不然没法在不预留很多空位的情况下,合理的显示。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值