Skip to content Skip to sidebar Skip to footer

Recycleview Not Showing In Dialogue Fragment

I have a Dialogue Fragment which a RecycleView will shown inside it.This is driving me crazy,cause I almost see all the SO question about RecycleView not show up problem,but still

Solution 1:

Most probably issue with android:layout_weight="1" You havent used weights anywhere other than the RecyclerView in parent Layout.

android:layout_height="0dp"android:layout_weight="1"

Here height is 0dp and weight is used in a RelativeLayout. These wont work.

First of all, weights wont work with RelativeLayouts. Your Recycler view is child of RelativeLayout. So, if you have a predefined size then remove the weight and set some height to your recycler view

<android.support.v7.widget.RecyclerView
        android:id="@+id/comment_recycler_view"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:animateLayoutChanges="false"
        android:scrollbars="vertical" />

OR Use appropriate weights for proper height distribution with a LinearLayout as parent. That should fix it.

Solution 2:

The combination android:layout_weight="1" and android:layout_height="0dp" works only inside a linear layout. If you want to use weight attribute, put your recycler inside a LinearLayout or set a custom height instead. Basically your problem is that your recycler height is "0dp"

Solution 3:

Wherever you add layout_weight attribute set width or height to 0dp respectively. Also assign weigths to other elements giving weight to one element only is not a good practice they will cover the whole layout.

Solution 4:

Try this line in onCreate() method : setStyle(STYLE_NORMAL, android.R.style.ThemeOverlay)

Post a Comment for "Recycleview Not Showing In Dialogue Fragment"