Views under RecyclerView not being displayed (only shows in Android Studio preview)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Views under RecyclerView not being displayed (only shows in Android Studio preview)



This has been driving me nuts for a while now. I have a RecyclerView and a TextView below it. However, I can see everything above the RecyclerView but nothing below it.



Below is what my layout consists of, I just included the relevant codes


<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".HomeFragment">

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_marginTop="@dimen/activity_vertical_margin"



<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="40dp"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:scrollbars="horizontal"
android:background="#f1f5f8"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/someTextView"

/>



<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:fontFamily="@font/droid_serif"
android:text="@string/browse"
android:textSize="18sp"
android:layout_marginTop="40dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/recycler_view" />


</android.support.constraint.ConstraintLayout>

</FrameLayout>

</android.support.v4.widget.NestedScrollView>



I have tried some approaches that I have found on the internet like replacing my original ScrollView with a NestedScrollView since my RecycleView scrolls horizontally but to no avail.


ScrollView


NestedScrollView


RecycleView



I have also tried adding this app:layout_behavior="@string/appbar_scrolling_view_behavior" to the RecyclerView in the XML but also same output.


app:layout_behavior="@string/appbar_scrolling_view_behavior"


RecyclerView



I would really appreciate any help as I have not found any case on the internet or SO like mine. Please note this is not the full layout file. There is other views above the RecyclerView but these are being displayed without any issue and hence I didn't put their codes. Let me know if there is any other information you need.


RecyclerView



Thanks!




2 Answers
2



try change your constraint layout to linearlayout (orientation vertical).
like this


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>



<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="40dp"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:scrollbars="horizontal"
android:background="#f1f5f8"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/someTextView"

/>



<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:fontFamily="@font/droid_serif"
android:text="@string/browse"
android:textSize="18sp"
android:layout_marginTop="40dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/recycler_view" />


</LinearLayout>





That also didn't work.
– Mostafa Osama
Aug 6 at 22:41



set id "bottomTextView" for TextView that is below RecyclereView and
add app:layout_constraintBottom_toTopOf="bottomTextView" for RecyclerView


app:layout_constraintBottom_toTopOf="bottomTextView"





That didn't work.
– Mostafa Osama
Aug 6 at 22:23





share full code of your layout. also you can use RelativLayout insted of ConstraintLayout.
– mostafa3dmax
Aug 7 at 7:16







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard