title: Android: How to add a view inside a view programmatically?
body: <p>I want to do something like this:</p>
  
  <pre><code>View v1= new View(this);
  v1.setBackgroundResource(R.drawable.pic1);
  
  View v2 = new View(this);
  v2.setBackgroundResource(R.drawable.pic2);
  
  v1.addView(v2);
  
  RelativeLayout.LayoutParams params;
  rl = (RelativeLayout) findViewById(R.id.activity_main);
  rl.addView(v1,params);
  </code></pre>
  
  <p>I know the code is wrong. It just show how I want to do.</p>
  
  <p>Some websides said that viewGroup may help me to achieve this.</p>
  
  <p>I had tried but never can v2 be shown on the screen.</p>
  
  <p>Does someone can tell me how to achieve this?</p>