title: How can I add empty space in LinearLayout?
body: <p>I want my to make a compound controls by extending a LinearLayout, here is my code:</p>
  
  <pre><code>public class MemberView extends LinearLayout {
      private TextView contactName;
      private ImageView removeContact;
      private ImageView contactPicture;
  
      public MemberView(Context context) {
      super(context);
      //Context thisContext = getContext();
      onCreate(context);
  
  
      }
  
      private void onCreate(Context context) {
      contactName = new TextView(context);
      contactName.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      contactName.setText("Mohammad");
  
      removeContact = new ImageView(context);
      removeContact.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      removeContact.setImageResource(R.drawable.ic_menu_delete);
  
      contactPicture = new ImageView(context);
      contactPicture.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      contactPicture.setImageResource(R.drawable.ic_contact_picture);
  
      setClickable(true);
      setOrientation(LinearLayout.HORIZONTAL);
      addView(contactName);
      addView(removeContact);
      addView(contactPicture);
      }
  }
  </code></pre>
  
  <p>I want it to look like the following <strong>UI Prototype</strong>:</p>
  
  <p><img src="https://i.stack.imgur.com/60LhN.png" alt="enter image description here"></p>
  
  <p>But the result of my code is:</p>
  
  <p><img src="https://i.stack.imgur.com/TM0mM.png" alt="enter image description here"></p>
  
  <p>I tried adding a VERTICAL LinearLayout and add some spaces to it, but no use:
  Here is the edited onCreate code:</p>
  
  <pre><code>private void onCreate(Context context) {
      contactName = new TextView(context);
      contactName.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      contactName.setText("Mohammad");
  
      removeContact = new ImageView(context);
      removeContact.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      removeContact.setImageResource(R.drawable.ic_menu_delete);
  
      contactPicture = new ImageView(context);
      contactPicture.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      contactPicture.setImageResource(R.drawable.ic_contact_picture);
  
      LinearLayout layout2 = new LinearLayout(context);
      layout2.setOrientation(LinearLayout.VERTICAL);
      layout2.addView(new Space(context));
      layout2.addView(contactName);
      layout2.addView(new Space(context));
  
  
      setClickable(true);
      setOrientation(LinearLayout.HORIZONTAL);
      addView(layout2);
      addView(removeContact);
      addView(contactPicture);
      }
  </code></pre>