Item in RecyclerView not filling it's width match_parent
<p>I have a problem with my <code>RecyclerView</code> and its child items. They do not extend through the whole <code>android:layout_width="match_parent"</code> nor <code>fill_parent</code>. I've tried both. The thing is, this work perfectly and with no changes, it got ruined somehow.</p>

<p>I am showing this in a <code>FragmentDialog</code> and the child items only expand like <code>wrap_content</code> when I scroll the view up and down, they are fully expanded but as soon as I click on them (I call <code>notifyDataSetChanged()</code>) they shrink again.</p>

<p>Here is a picture of a properly filled item and below it's how they are when they load or when I notifyData. Also the <code>StickHeaderAdapter</code> that I use, does not show headers until I click on one of the items (this work previously and I changed nothing on that part either).</p>

<p><a href="https://i.stack.imgur.com/LlGmJ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/LlGmJ.jpg" alt="recyclerview child problem"></a></p>

<p>Here is the code for the child row:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;carbon.widget.LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    app:carbon_rippleColor="@color/green"
    app:carbon_rippleStyle="background"&gt;

&lt;carbon.widget.TextView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:id="@+id/block_name"
    android:padding="@dimen/block_row_padding"
    android:layout_weight="1"
    android:textSize="@dimen/block_row_text_size"
    android:textColor="@color/black"
    app:carbon_rippleColor="@color/green"
    app:carbon_rippleStyle="background"/&gt;

&lt;RelativeLayout
    android:id="@+id/download_layout"
    android:layout_width="64dp"
    android:layout_height="match_parent"
    android:layout_marginRight="24dp"
    android:layout_marginEnd="24dp"
    android:visibility="gone"&gt;


    &lt;carbon.widget.ProgressBar
        android:id="@+id/downloading_bar"
        app:carbon_progressStyle="circular_indeterminate"
        app:carbon_barWidth="5dp"
        app:carbon_tint="@color/green"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_gravity="center"
        android:layout_margin="8dp"
        android:visibility="invisible"/&gt;

    &lt;carbon.widget.TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/block_progress_download"
        android:textSize="12sp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:visibility="invisible" /&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p></p>

<p>And here is the part of the adapter code where I create <code>ViewHolder</code>:</p>

<pre><code>@Override
public BlockAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.block_row, parent, false);
    return new ViewHolder(view);
}
</code></pre>

<p>This is the binding code if it helps:</p>

<pre><code>@Override
public void onBindViewHolder(BlockAdapter.ViewHolder holder, int position) {
    if (blockData.isDownloading()) {
        holder.download_layout.setVisibility(View.VISIBLE);
        holder.download_bar.setVisibility(View.VISIBLE);
        if (blockData.getProgress() != null) {
            holder.download_progress.setVisibility(View.VISIBLE);
            holder.download_progress.setText(String.format("%d%%", blockData.getProgress()));
        }
    } else {
        holder.download_layout.setVisibility(View.GONE);
        holder.download_bar.setVisibility(View.GONE);
        holder.download_progress.setVisibility(View.GONE);
    }

    if (selected) {
        holder.itemView.setBackgroundColor(mContext.getResources().getColor(R.color.green));
        holder.block_name.setTextColor(mContext.getResources().getColor(R.color.white));
    } else {
        holder.itemView.setBackgroundColor(mContext.getResources().getColor(R.color.white));
        holder.block_name.setTextColor(mContext.getResources().getColor(R.color.black));
    }

}
</code></pre>

<p>I don't know why this work in the morning and changed later...</p>

<p><strong>Things I tried:</strong></p>

<ul>
<li>Change <code>match_parent</code> for <code>fill_parent</code></li>
<li>Set <code>RecyclerView.LayoutParams</code> to <code>LayoutParams.MATCH_PARENT</code></li>
<li>Change width programatically</li>
<li>Change createViewHolder from <code>..., parent, false);</code> to <code>..., null);</code> and add Params seperatelly</li>
<li>Logged the width (sometimes it's like 390, when I scroll it gets to 990 and when I click back to 390)</li>
<li>Setup <code>StickHeaders</code> sooner, but they are all set when they get created and header is there, it's just invisible.</li>
</ul>

<p>ANY HELP IS APPRECIATED!</p>