
在我的Android应用程序中,有一个屏幕,其中包含一些要以表格格式显示的数据.该表将包含约5列和至少50行.
如何在androID中创建表格?
我进行了搜索,似乎每个人都建议为每个单元格使用tableLayout和textVIEw.由于存在许多textVIEw组件,因此使用此技术似乎有点困难.
还有其他解决方案吗?
解决方法:
tableLayout ltableLayout;ltableLayout = (tableLayout)findVIEwByID(R.ID.tblayout);for(int i=0;i<10;i++){tableRow tr1 = new tableRow(this);tr1.setpadding(0, 5, 0, 0);ltableLayout.addVIEw(tr1, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);TextVIEw tv11 = new TextVIEw(this);tv11.setpadding(2, 0, 0, 0);tv11.setTextSize(12);tr1.addVIEw(tv11,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); // Can give wIDth and height in numbers also.}这些将在采用的表格布局中创建10行和每行1个textvIEw.
在您的xml文件中采用一种表格布局,如下所示:
<tableLayout androID:ID="@+ID/tblayout" androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" ></tableLayout> 总结 以上是内存溢出为你收集整理的Android中的表格全部内容,希望文章能够帮你解决Android中的表格所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)