簡體   English   中英

將視圖添加到TableLayout會占用整個屏幕

[英]Adding View to TableLayout Takes Up Whole Screen

我只是想在表格布局的標題行下添加分隔線,但是無論我在layoutparams中將width / height設置為什么,該視圖都會占用整個頁面。

TableLayout tl = (TableLayout)FindViewById(Resource.Id.counted);
TableRow row = new TableRow(this);
TextView itemNumber = new TextView(this);
TextView itemDesc = new TextView(this);
TextView quantity = new TextView(this);

itemNumber.Text = "Item Number";
var inlo = new TableRow.LayoutParams(1);
inlo.SetMargins(10, 10, 30, 10);
itemNumber.LayoutParameters = inlo;

itemDesc.Text = "Item Description";
var idlo = new TableRow.LayoutParams(2);
idlo.SetMargins(10, 10, 30, 10);
itemDesc.LayoutParameters = inlo;

quantity.Text = "Quantity";
var qlo = new TableRow.LayoutParams(3);
qlo.SetMargins(10, 10, 30, 10);
quantity.LayoutParameters = qlo;

View v = new View(this);
v.LayoutParameters = new TableRow.LayoutParams(ViewGroup.LayoutParams.FillParent | 0);
v.SetBackgroundColor(Android.Graphics.Color.White);

row.AddView(itemNumber);
row.AddView(itemDesc);
row.AddView(quantity);

tl.AddView(row);
tl.AddView(v);

v及其白色背景占據了行下方的整個屏幕。 ????

只是決定使用Strings在我的列標題下划線,而不是嘗試在第一行下放置一行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM