[英]TableLayout inside HorizontalScrollView adds padding when multiple rows are added to the Table
[英]How to make Table with Multiple coloumn and rows are added dynamicaly
我想在Android中創建帶有多列的表格。 我需要3-4列,我應該能夠在表中動態添加行。 有人可以為此提供示例代碼嗎? 我已經嘗試過使用“基本適配器”和“列表”視圖,但是問題是,當我移動“列表”視圖時,“水平固定”列將無法正確移動。 它移動但延遲很小。 我不知道該怎么做,從上一個弱點開始,我正在尋找這個問題,任何機構都可以幫助我。 如果您願意,我可以更簡單地解釋。
TableLayout tl = (TableLayout)findViewById(R.id.TableLayout01);
TableRow tr = new TableRow(this);
tr.setId(100);
tr.setOrientation(TableRow.VERTICAL);
TextView textvw01 = new TextView(this);
textvw01.setId(200);
textvw01.setText("blah");
tr.addView(textvw01);
TextView textvw02 = new TextView(this);
textvw02.setId(300);
textvw02.setText("Blah2");
tr.addView(textvw02);
/* Add row to TableLayout. */
tl.addView(tr,new TableLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
試試看,可能對你有用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.