title: How to avoid the stretching of Images in Android
body: <p>I trying to put images programmatically .But when I putting the images they are getting stretched. I am using Micromax Canvas to view my application.</p>
  
  <p>This is my code </p>
  
  <pre><code>void populateData(){
          populate=(LinearLayout)findViewById(R.id.populate);
          LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                  LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
          params.weight=1.0f;
  
          for(int i=0;i&lt;10;i++) {
              LinearLayout hr_populate=new LinearLayout(this);
              hr_populate.setOrientation(LinearLayout.HORIZONTAL);
  
              ImageView img=new ImageView(this);
              img.setBackgroundResource(R.drawable.spicejet);
  
              img.setLayoutParams(params);
              ImageView img1=new ImageView(this);
              img1.setBackgroundResource(R.drawable.book);
              img1.setLayoutParams(params);
              ImageView img2=new ImageView(this);
              img2.setBackgroundResource(R.drawable.arrow);
              img2.setLayoutParams(params);
  
              TextView text = new TextView(this);
              text.setText("BOS");
              text.setLayoutParams(params);
              TextView text1 = new TextView(this);
              text1.setText("SAN");
              text1.setLayoutParams(params);
              TextView text2 = new TextView(this);
              text2.setText("6h15m");
              text2.setLayoutParams(params);
              TextView text3 = new TextView(this);
              text3.setText("32,163");
              text3.setLayoutParams(params);
  
              LinearLayout book_div = new LinearLayout(this);
              book_div.setOrientation(LinearLayout.VERTICAL);
              book_div.setLayoutParams(params);
  
              book_div.addView(text3);
              book_div.addView(img1);
  
              hr_populate.addView(img);
              hr_populate.addView(text);
              hr_populate.addView(text1);
              hr_populate.addView(text2);
              hr_populate.addView(book_div);
              hr_populate.addView(img2);
              populate.addView(hr_populate);
          }
      }
  </code></pre>
  
  <p>This is my XML code </p>
  
  <pre><code>&lt;ScrollView 
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="10dp"
          android:layout_below="@+id/sortFlightLayouts"&gt;
  
          &lt;LinearLayout android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:id="@+id/populate"
              android:orientation="vertical"&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/ScrollView&gt;
  </code></pre>
  
  <p>Please suggest me what changes I have to make to get out from this issue </p>