I have this layout in two applications, one inside the RecyclerView, and the other in the layout with root privileges.
Here's the layout:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" android:orientation="vertical" android:layout_marginTop="4dp" android:layout_marginBottom="4dp" android:layout_marginLeft="4dp" android:layout_marginRight="4dp" android:background="#CFCFCF" android:minHeight="250dp"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_red_dark" > <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_bright" android:layout_above="@+id/commerceTextView" > <ImageView android:src="@drawable/imagen" android:id="@+id/commerceImageView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center"/> </FrameLayout> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/commerceTextView" android:gravity="center" android:textStyle="bold" android:textSize="24sp" android:textColor="#F1F1F1" android:background="@color/colorPrimary" android:layout_alignParentBottom="true" android:paddingTop="10dp" android:text="Best food ever" android:paddingBottom="10dp"/> </RelativeLayout> </FrameLayout>
Here is the adapter
public class CommercesAdapter extends RecyclerView.Adapter<CommercesAdapter.CommercesViewHolder> { private final Context context; private final ImageLoader loader; private List<CommerceEntity> commercesList; @Inject public CommercesAdapter(Context context, ImageLoader loader) { this.context = context; this.loader = loader; } public void setData(List<CommerceEntity> commercesList) { this.commercesList = commercesList; } @Override public CommercesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(context) .inflate(R.layout.list_comerces_item, parent, false); return new CommercesViewHolder(view); } @Override public void onBindViewHolder(CommercesViewHolder holder, int position) { CommerceEntity commerce = commercesList.get(position); String imageUri = commerce.getImageUri(); String name = commerce.getName();
Here is the RecyclerView 
And here in the layout of the root image

Does anyone know why this is happening? if I add android: centerInParent "true" for the nested FrameLayout, an image will appear, but I don't understand why.
Borja source share