Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - RelativeLayout as item overlay in ListView
    primarykey
    data
    text
    <p>I have a ListView backed up by a BaseAdapter. The layout that I'm using is a RelativeLayout with some TextViews and ImageViews that are rendering ok. The problem is that I want to grey out some items in the list. I created an empty RelativeLayout that should match the parent height and width, but it doesn't render at all unless I put for example a TextView in it. Why is this behavior and how can I grey an ListView item out ?</p> <p>Thanks!</p> <p>The layout is here:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; </code></pre> <p></p> <pre><code>&lt;RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="10dp" android:paddingTop="10dp" &gt; &lt;RelativeLayout android:id="@+id/leftIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="10dp" &gt; &lt;ImageView android:id="@+id/item_arrow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/list_item_arrow" android:contentDescription="@null" android:visibility="gone" /&gt; &lt;ImageView android:id="@+id/item_plus" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/icon_plus" android:contentDescription="@null" android:visibility="gone" /&gt; &lt;ImageView android:id="@+id/item_arrow_down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/list_item_arrow_down" android:contentDescription="@null" android:visibility="gone" /&gt; &lt;/RelativeLayout&gt; &lt;TextView android:id="@+id/textViewCount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dip" android:layout_marginRight="20dip" android:layout_toLeftOf="@id/leftIcon" android:textColor="@color/font_dark_gray" android:textSize="17sp" android:textStyle="bold" /&gt; &lt;TextView android:id="@+id/menu_item_name" style="@style/MenuRowStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:layout_toLeftOf="@id/textViewCount" android:ellipsize="end" android:lines="1" /&gt; &lt;/RelativeLayout&gt; &lt;!-- Problematic overlay layout --&gt; &lt;RelativeLayout android:id="@+id/overlay" android:layout_width="match_parent" android:layout_height="match_parent" android:background="grey_color_code" android:layout_centerInParent="true" android:visibility="visible" &gt; &lt;!-- If this is not here the overlay doesn not render on screen --&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dip" android:layout_marginRight="20dip" android:layout_toLeftOf="@id/leftIcon" android:textColor="@color/font_dark_gray" android:textSize="17sp" android:textStyle="bold" /&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload