enter image description hereI have a set of images to be added. I have to place one image in first row and the images in second row should start at the end of first row image
How can I achieve it with linearlayout in xamrin android?
enter image description hereI have a set of images to be added. I have to place one image in first row and the images in second row should start at the end of first row image
How can I achieve it with linearlayout in xamrin android?
Do you want to achieve it like following screenshot.
If so, you could used linearLayout.SetPaddingRelative(imageView1.Drawable.IntrinsicWidth, 0,0,0);
to set the start of padding in following linearlayout.
there is my code.
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);
LinearLayout ll_layout = FindViewById<LinearLayout>(Resource.Id.ll_layout);
LinearLayout linearLayout1 = new LinearLayout(this);
ImageView imageView1 = new ImageView(this);
imageView1.SetImageResource(Resource.Drawable.Capture1);
linearLayout1.AddView(imageView1);
ll_layout.AddView(linearLayout1);
LinearLayout linearLayout2 = new LinearLayout(this);
linearLayout2.SetPaddingRelative(imageView1.Drawable.IntrinsicWidth, 0,0,0);
ImageView imageView2 = new ImageView(this);
imageView2.SetImageResource(Resource.Drawable.Capture2);
linearLayout2.AddView(imageView2);
ll_layout.AddView(linearLayout2);
}