Match_parent on dynamically added GridLayout

Home / Uncategorized / Match_parent on dynamically added GridLayout

Question:
I have some TextView inside a GridLayout. The GridLayout is inflated dynamically at runtime and then added to the main layout. The width of my boxitem (the GridLayout) is scaled correctly but the height seems to always wrap the content. I want the height do match the parent.

main.axml:

border.xml:


BoxItem.axml:



and here is my On Create
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
var view = LayoutInflater.Inflate(Resource.Layout.BoxItem, null);
FindViewById(Resource.Id.CenterLayout).AddView(view);
}


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *