title: WRAP_CONTENT not not wrapping up the listview width in android
body: <p>I have a <code>listView</code> which contains a list of app icons.I am trying to set <code>listview</code> height and width programmatically like this:</p>
  
  <pre><code>listView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  </code></pre>
  
  <p>But the width of the <code>listView</code> is not wrapping up according to the width of the app icons.It is just simply covering the whole screen.
  I have implemented the <code>listView</code> on simple <code>LinearLayout</code>.Is there any solution.  </p>
  
  <p>I am using <code>listview</code>in service with <code>windowManager</code> so I set its height and width by code like this:</p>
  
  <p>First of all I have set the linear layout height and width like this:</p>
  
  <pre><code>LinearLayout.LayoutParams listParam=new LinearLayout.LayoutParams(
              80, ViewGroup.LayoutParams.WRAP_CONTENT
      );
      listLinear.setLayoutParams(listParam); //listLinear is my linearLayout
  </code></pre>
  
  <p>after I added listview inside the linearLayout:</p>
  
  <pre><code>listView.setId(listId);
      listView.setAdapter(listadapter);
      listView.setLayoutParams(new LinearLayout.LayoutParams(80, ViewGroup.LayoutParams.WRAP_CONTENT));    
      listLinear.addView(listView);
  </code></pre>
  
  <p>I want to replace 80 with WRAP_CONTENT as a width.</p>