LinearLayout Weights not working inside Listview
<p>I have searched and found that many people have reported this issue.
These are some of the links that I have gone throught : </p>

<ul>
<li><p><a href="https://stackoverflow.com/questions/12893396/how-to-use-androidlayout-weight-with-listview">How to use android:layout_weight with listview</a></p></li>
<li><p><a href="https://stackoverflow.com/questions/21313240/android-listview-layout-weight-not-working-height-set-to-0dp">Android, ListView layout_weight not working, height set to 0dp</a></p></li>
<li><a href="https://stackoverflow.com/questions/28076091/android-linear-layout-weight-not-working-properly-in-listview-items">Android - Linear layout weight not working properly in listview items</a></li>
<li><a href="https://stackoverflow.com/questions/36023338/why-is-my-layout-weight-not-working">why is my layout_weight not working?</a></li>
<li><a href="https://stackoverflow.com/questions/20060964/android-layout-weight-not-working">Android - layout_weight not working</a></li>
<li><a href="https://stackoverflow.com/questions/34997314/android-inside-custom-listview-textview-weight-property-not-working">Android Inside Custom ListView, TextView Weight property not working</a></li>
<li><a href="https://stackoverflow.com/questions/22725258/android-layout-weight-for-fixed-width-not-working">Android Layout_Weight for Fixed Width Not Working</a></li>
</ul>

<p>and some others as well</p>

<p>These links have suggested the following solutions</p>

<ol>
<li>Replacing  mInflater.inflate(resID, parent, false); with mInflater.inflate(resID, null, false);</li>
<li>Making list view as 
android:layout_width="match_parent"
  android:layout_height="wrap_content"
I even tried experimenting with fill_parent but it didnt work.</li>
<li>Listview inside another linear layout</li>
<li>Row xml inside a Relative layout and withing that a Linear layout</li>
<li>For Horizontal orientation make android:layout_width="0dp". When I do this, the listview is not poplutated. It remains blank</li>
</ol>

<p>I am not able find anything for this particular problem in android documentation either.</p>

<p>My list view: </p>

<pre><code>  android:id="@+id/lst_stocks"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/row_heading"
    android:layout_marginTop="@dimen/margin_5"
</code></pre>

<p>My other xml file:</p>

<pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/border"
android:orientation="horizontal"
android:weightSum="3"&gt;


&lt;TextView
    android:id="@+id/txt_rating"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:padding="@dimen/margin_10"
    android:text="Rating"
    android:textAlignment="center"
    android:textColor="@color/colorPrimaryDark" /&gt;

&lt;TextView
    android:id="@+id/txt_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:ellipsize="end"
    android:maxEms="10"
    android:padding="@dimen/margin_10"
    android:singleLine="true"
    android:text="Companay"
    android:textAlignment="center"
    android:textColor="@color/colorPrimaryDark"
    /&gt;

&lt;TextView
    android:id="@+id/txt_sector"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:ellipsize="end"
    android:maxEms="10"
    android:padding="@dimen/margin_10"
    android:singleLine="true"
    android:text="Sector"
    android:textAlignment="center"
    android:textColor="@color/colorPrimaryDark" /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>I am using this xml file in other places as well, where it works perfectly fine.</p>

<ul>
<li>So what am I missing. Why are the Linear layout weights not working?</li>
<li>Guidelines for using LinearLayouts inside Listviews effectively</li>
</ul>

<p>P.S. I have run the files on two separate mobiles and not on a emulator.</p>