我理解基本的AXML用法,例如:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Home);
}
有没有办法合并AXML的片段,如:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var layout = new LinearLayout(this);
layout.AddView(Resource.Layout.HomePart1);
layout.AddView(Resource.Layout.HomePart2);
SetContentView(layout);
}
答案 0 :(得分:2)
您可以调用LayoutInflater.Inflate从资源文件构建视图:
var view = LayoutInflater.Inflate(Resource.Layout.HomePart1, null);