将视图添加到 TableLayout 会占用整个屏幕
我只是想在表格布局中的标题行下添加分隔线,但无论我在布局参数中将宽度/高度设置为多少,视图都会占据整个页面。
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 及其白色背景占据了行下方的整个屏幕。 ????
I am simply trying to add a separator line under my header row in a table layout, but no matter what i set the width/height to in layoutparams, the view takes up the whole page.
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 and its white background takes up the whole screen below row. ????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是决定使用字符串在我的列标题下划线,而不是尝试在第一行下方添加一行。
Just decided to use Strings to underline my column headers rather than trying to put a line under the first row.