机器人可滚动TableLayout用动态固定报头 [英] Android scrollable TableLayout with a dynamic fixed header
问题描述
我有一个 TableLayout
在滚动型
,这是我有一个滚动的 TableLayout
!它是动态填充,当我在活动
的不同地方,对话框
的创建。
I have a TableLayout
inside a ScrollView
, that is I have a scrollable TableLayout
! It is populated dynamically when I create Dialog
's in different places of an Activity
.
其实一切正常,但在该表中的事实,每一种情况下有不同的页眉(与每列标题),并滚动随着行。作为该表的内容是动态的,列的数量(以及宽度)是未知的。
Actually everything works fine, but the fact that for every case there's a different header (with a title for each column) on that table and it scrolls along with the rows. As the content of that table is dynamic, the amount (as well as the width) of columns is unknown.
所以,基本上,这是我的问题。我看不出一点张贴code,因为我需要大多建议/解决办法,但如果这将有助于解决这个问题,让我知道。请问AP preciate一些样品非常多。
So, basically, that's my problem. I don't see point in posting code, as I need mostly a suggestion/workaround, but if that would help overcome the issue, let me know. Would appreciate some samples very much.
推荐答案
下面是一个方法: http://sdroid.blogspot.com/2011/01/fixed在--header-tablelayout.html
请注意,有一种方法可以有这样的工作,每次:你所要做的就是建立在头部的类似虚拟行,并设置在两个假人可以行中找到的最长的字符串文本(以一些字符,或者,甚至更好,做Paint.getTextWidths的比较)
Note that there is a way to have this work every time : what you have to do is create a similar dummy row in the header, and set the texts in both dummies to the longest string you can find in the row (in number of chars, or, even better, do the comparison with Paint.getTextWidths)
这篇关于机器人可滚动TableLayout用动态固定报头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!