Android API19: problems displaying a child in a RecyclerView

1

I have a RecyclerView that has to inflate the following layout in its ViewHolder:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:minWidth="25px"

    android:minHeight="25px"

    android:layout_width="match_parent"

    android:layout_height="wrap_content">

    <android.support.percent.PercentRelativeLayout

        android:id="@+id/imageRelative"

        ....

        ....


    <LinearLayout

        android:id="@+id/premiumBlockerView"

        android:layout_height="match_parent"

        android:layout_width="match_parent"

        android:layout_alignParentRight="true"

        android:layout_alignParentTop="true"

        android:layout_alignParentLeft="true"

        android:alpha="0.5"

        android:background="@color/Black"

        android:layout_alignBottom="@id/linearLayout1" />

</RelativeLayout>

The content (image, video, text, etc.) of the RelativeLayout is changing and for this reason it is not possible to determine its height a priori (the width is the width of the device). I have to add a view (my premiumBlockerView LinearLayout) that I will show or not (depending on the content) as if it were a semi-transparent glass over all the content.
The problem is that the height = match_parent in the premiumBlockerView does not work and is always at zero. Therefore, like other posts with similar problems suggest, I added the parameters layout_alignParent and AlignBottom and everything works correctly for APIs greater than 20.
Now the application must also work for API 19 and with this it does not work.
Does anybody have any suggestions?
Thanks.

    
asked by Valerio C 13.05.2017 в 11:18
source

0 answers