title: Dynamic Nested Relative layout in Xamarin Android
body: <p>I want to create a layout to browse for category and subcategory that looks like: </p>
  
  <p><a href="https://i.stack.imgur.com/WvY3E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WvY3E.png" alt="enter image description here"></a></p>
  
  <p>This is for Category and I made this by write .axml in layout that looks fine. Now, when user click category same looks should be generated on its click and it is creating dynamically but child content overlap to parent content and look like this:   </p>
  
  <p><a href="https://i.stack.imgur.com/1HHo0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1HHo0.png" alt="enter image description here"></a></p>
  
  <p>To make a child relative layout I write the below code:</p>
  
  <pre><code>RelativeLayout childTaxonomylayout = new RelativeLayout( this );
  childTaxonomylayout.Id = Convert.ToInt32( data.Value.Id );
  childTaxonomylayout.SetOnClickListener( this );
  var param = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
  param.AddRule(LayoutRules.AlignParentBottom);
  param.AddRule( LayoutRules.AlignParentLeft );
  childTaxonomylayout.LayoutParameters = param;
  
  
  TextView textViewChild = new TextView( this );
  textViewChild.Text = data.Value.Item.Name;
  textViewChild.SetPadding( 20, 10, 0, 10 );
  textViewChild.Id = Convert.ToInt32( data.Value.Id );
  
  RelativeLayout.LayoutParams rlp2 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.WrapContent );
  rlp2.AddRule( LayoutRules.AlignParentBottom );
  rlp2.AddRule( LayoutRules.AlignParentLeft );
  textViewChild.LayoutParameters = rlp2;
  
  childTaxonomylayout.AddView( textViewChild );
  if (data.Value.Children.Count != 0) {
      var _imgViewClose = new ImageView( this );
      _imgViewClose.Id = Convert.ToInt32( "123" + data.Value.Id.ToString() );
      _imgViewClose.SetImageResource( Resource.Drawable.ic_right );
  
      RelativeLayout.LayoutParams rlp1 = new RelativeLayout.LayoutParams(30, 20 );
      rlp1.AddRule( LayoutRules.AlignParentBottom );
      rlp1.AddRule( LayoutRules.AlignParentRight );
      childTaxonomylayout.AddView( _imgViewClose );
  }
  
  childLayout.AddView( childTaxonomylayout );
  </code></pre>
  
  <p>Please let me know what should I change to make my UI correct. Thankyou</p>