title: Text View surrounded by Rectangular Shape has extra space in layout
body: <p>This is the question I asked earlier today:
  <a href="https://stackoverflow.com/questions/68538987/recreate-shape-as-in-xml-file-by-using-code-and-set-width-programmatically">Recreate shape as in xml file by using code and set width programmatically</a></p>
  <p>Using the above solution provided, I was able to get the desired result but there is a small issue which I can't figure out. Please help me.</p>
  <p>The rectangle box should wrap the text view whatever its text length may be. But when the content is long than other text in the same view, gaps are shown.</p>
  <p>Here is the layout code which is loaded in the recycler view:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:orientation=&quot;horizontal&quot;
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;match_parent&quot;
      android:id=&quot;@+id/lin1&quot;
      android:weightSum=&quot;2&quot;&gt;
      &lt;RelativeLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:id=&quot;@+id/rel1&quot;
          android:layout_marginLeft=&quot;5dp&quot;
          android:layout_weight=&quot;1.50&quot;&gt;
          &lt;TextView
              android:id=&quot;@+id/list&quot;
              android:textSize=&quot;@dimen/grid_row_text_size&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:minWidth=&quot;100dp&quot;
              android:textColor=&quot;@color/orange&quot;
              android:textAlignment=&quot;center&quot;
              android:singleLine=&quot;true&quot;
              android:layout_marginRight=&quot;3dp&quot;
              android:gravity=&quot;center&quot;&gt;
  
          &lt;/TextView&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/info_icn&quot;
          android:layout_width=&quot;20dp&quot;
          android:layout_height=&quot;20dp&quot;
          android:layout_alignParentBottom=&quot;true&quot;
          android:src=&quot;@drawable/eye&quot;
          android:visibility=&quot;gone&quot;
          android:layout_weight=&quot;0.50&quot;
          android:layout_gravity=&quot;bottom&quot;
  
          /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/qhZCc.jpg" rel="nofollow noreferrer">This is the result which I am getting now</a></p>
  <p><a href="https://i.stack.imgur.com/bT7rr.jpg" rel="nofollow noreferrer">For more clearance on the issue, another pic of the above</a></p>
  <p><a href="https://i.stack.imgur.com/rtUFu.jpg" rel="nofollow noreferrer">This is the result I get after changing the top Linear Layout (android:layout_width=&quot;match_parent&quot;)</a></p>
  <p>If more code needed, I can post here. Please help me on this issue. Thanks a lot!</p>