why recycler view max height doesn't work? Also i tried recycler view add inside constraint layout but it doesn't workHow to set RecyclerView Max HeightHow to force TableRow have same heightNested Recycler view height doesn't wrap its contentDisable Tabs in TabLayoutHow can I create a recyclerview child in a recycler parent with auto heightMake RecyclerView height dynamic by wrapping specific number of it's child(not all child)android full width cardview in RecyclerviewRecyclerView items with big empty space v25.2.0Why TextView.getHeight() gives different values?RecycleView conflict with Constraint Layout.(Item view inside recycleview doesn't match_parent)Wrong height in view added Dynamically to a container in Android: weight, Linear and Constraint Layouts

Gibbs free energy in standard state vs. equilibrium

Why do IPv6 unique local addresses have to have a /48 prefix?

Should I install hardwood flooring or cabinets first?

Do Legal Documents Require Signing In Standard Pen Colors?

Diode in opposite direction?

Does the Mind Blank spell prevent the target from being frightened?

How should I respond when I lied about my education and the company finds out through background check?

Proving a function is onto where f(x)=|x|.

THT: What is a squared annular “ring”?

On a tidally locked planet, would time be quantized?

Sampling Theorem and reconstruction

Can I use my Chinese passport to enter China after I acquired another citizenship?

Freedom of speech and where it applies

A social experiment. What is the worst that can happen?

Visiting the UK as unmarried couple

Can someone explain how this makes sense electrically?

Why did the EU agree to delay the Brexit deadline?

Why does Async/Await work properly when the loop is inside the async function and not the other way around?

Have I saved too much for retirement so far?

Proof of Lemma: Every nonzero integer can be written as a product of primes

Do the concepts of IP address and network interface not belong to the same layer?

What linear sensor for a keyboard?

Folder comparison

Greco-Roman egalitarianism



why recycler view max height doesn't work? Also i tried recycler view add inside constraint layout but it doesn't work


How to set RecyclerView Max HeightHow to force TableRow have same heightNested Recycler view height doesn't wrap its contentDisable Tabs in TabLayoutHow can I create a recyclerview child in a recycler parent with auto heightMake RecyclerView height dynamic by wrapping specific number of it's child(not all child)android full width cardview in RecyclerviewRecyclerView items with big empty space v25.2.0Why TextView.getHeight() gives different values?RecycleView conflict with Constraint Layout.(Item view inside recycleview doesn't match_parent)Wrong height in view added Dynamically to a container in Android: weight, Linear and Constraint Layouts













0















I want to max height to recycler view but doesn't work for me. I found some answers but they didn't work for me.

I tried many ways to fix that. but I couldn't found the answer. this is XML code. Anyone can help me to solve that problem



<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>









share|improve this question
























  • Possible duplicate of How to set RecyclerView Max Height

    – user1506104
    Mar 8 at 7:25











  • @user1506104 i know this question already asked in here. But theirs solutions didn't work for me. Thats why again posted this question. Sorry for that

    – Nimantha
    Mar 10 at 13:42
















0















I want to max height to recycler view but doesn't work for me. I found some answers but they didn't work for me.

I tried many ways to fix that. but I couldn't found the answer. this is XML code. Anyone can help me to solve that problem



<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>









share|improve this question
























  • Possible duplicate of How to set RecyclerView Max Height

    – user1506104
    Mar 8 at 7:25











  • @user1506104 i know this question already asked in here. But theirs solutions didn't work for me. Thats why again posted this question. Sorry for that

    – Nimantha
    Mar 10 at 13:42














0












0








0








I want to max height to recycler view but doesn't work for me. I found some answers but they didn't work for me.

I tried many ways to fix that. but I couldn't found the answer. this is XML code. Anyone can help me to solve that problem



<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>









share|improve this question
















I want to max height to recycler view but doesn't work for me. I found some answers but they didn't work for me.

I tried many ways to fix that. but I couldn't found the answer. this is XML code. Anyone can help me to solve that problem



<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>






android android-layout android-recyclerview recyclerview-layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 7:42









Tamir Abutbul

1,9482822




1,9482822










asked Mar 8 at 6:38









NimanthaNimantha

183




183












  • Possible duplicate of How to set RecyclerView Max Height

    – user1506104
    Mar 8 at 7:25











  • @user1506104 i know this question already asked in here. But theirs solutions didn't work for me. Thats why again posted this question. Sorry for that

    – Nimantha
    Mar 10 at 13:42


















  • Possible duplicate of How to set RecyclerView Max Height

    – user1506104
    Mar 8 at 7:25











  • @user1506104 i know this question already asked in here. But theirs solutions didn't work for me. Thats why again posted this question. Sorry for that

    – Nimantha
    Mar 10 at 13:42

















Possible duplicate of How to set RecyclerView Max Height

– user1506104
Mar 8 at 7:25





Possible duplicate of How to set RecyclerView Max Height

– user1506104
Mar 8 at 7:25













@user1506104 i know this question already asked in here. But theirs solutions didn't work for me. Thats why again posted this question. Sorry for that

– Nimantha
Mar 10 at 13:42






@user1506104 i know this question already asked in here. But theirs solutions didn't work for me. Thats why again posted this question. Sorry for that

– Nimantha
Mar 10 at 13:42













2 Answers
2






active

oldest

votes


















0














Paste this code on your xml activity file. Hope this will work.



 <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />





share|improve this answer























  • thanks, i tried this, but it didn't work. I don't know why....

    – Nimantha
    Mar 10 at 13:17


















0














Your question is not so clear to me but if you want the recyclerView to take all of the screen space you should use this :



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>


If you want to limit your recyclerview height I would not recommend using fixed sized in dp - use guideline/barrier to make your recyclerView take only some percent of the screen, for example if you want your view only take 30% of your screen use guidelines with 30% different and constrain your view to them like this:



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toTopOf="@+id/guideline3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline2" />

</androidx.constraintlayout.widget.ConstraintLayout>





share|improve this answer























  • i want to add recycler view inside dialog. i used recycler view height as wrap content . when lot of items have dialog height so big. when recycler view height goes more than 400dp (as a example) it should be stopped (i mean height) . then other item to view scroll down. But i used max width in recycler view it didn't work. Also i created a constraint layout and add recycler view inside it and set height to 0dp . it didn't worked

    – Nimantha
    Mar 10 at 13:24












  • This is not a good practice(the fixed sizes), what is wrong with my answer? why not use constraint layout with guidelines like the example I gave?

    – Tamir Abutbul
    Mar 10 at 13:26











  • didn't work bro. ( I used recycler view in dialog) it could be the reason this method didn't work....

    – Nimantha
    Mar 10 at 13:54











  • Ok in that case creat custom dialog with custom layout and in your layout try to do as i sujested in my answer with guidlines.This should work

    – Tamir Abutbul
    Mar 10 at 14:01










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057956%2fwhy-recycler-view-max-height-doesnt-work-also-i-tried-recycler-view-add-inside%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Paste this code on your xml activity file. Hope this will work.



 <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />





share|improve this answer























  • thanks, i tried this, but it didn't work. I don't know why....

    – Nimantha
    Mar 10 at 13:17















0














Paste this code on your xml activity file. Hope this will work.



 <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />





share|improve this answer























  • thanks, i tried this, but it didn't work. I don't know why....

    – Nimantha
    Mar 10 at 13:17













0












0








0







Paste this code on your xml activity file. Hope this will work.



 <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />





share|improve this answer













Paste this code on your xml activity file. Hope this will work.



 <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="100dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constraintHeight_max="100dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 8 at 7:19









Aovin MahmudAovin Mahmud

133114




133114












  • thanks, i tried this, but it didn't work. I don't know why....

    – Nimantha
    Mar 10 at 13:17

















  • thanks, i tried this, but it didn't work. I don't know why....

    – Nimantha
    Mar 10 at 13:17
















thanks, i tried this, but it didn't work. I don't know why....

– Nimantha
Mar 10 at 13:17





thanks, i tried this, but it didn't work. I don't know why....

– Nimantha
Mar 10 at 13:17













0














Your question is not so clear to me but if you want the recyclerView to take all of the screen space you should use this :



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>


If you want to limit your recyclerview height I would not recommend using fixed sized in dp - use guideline/barrier to make your recyclerView take only some percent of the screen, for example if you want your view only take 30% of your screen use guidelines with 30% different and constrain your view to them like this:



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toTopOf="@+id/guideline3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline2" />

</androidx.constraintlayout.widget.ConstraintLayout>





share|improve this answer























  • i want to add recycler view inside dialog. i used recycler view height as wrap content . when lot of items have dialog height so big. when recycler view height goes more than 400dp (as a example) it should be stopped (i mean height) . then other item to view scroll down. But i used max width in recycler view it didn't work. Also i created a constraint layout and add recycler view inside it and set height to 0dp . it didn't worked

    – Nimantha
    Mar 10 at 13:24












  • This is not a good practice(the fixed sizes), what is wrong with my answer? why not use constraint layout with guidelines like the example I gave?

    – Tamir Abutbul
    Mar 10 at 13:26











  • didn't work bro. ( I used recycler view in dialog) it could be the reason this method didn't work....

    – Nimantha
    Mar 10 at 13:54











  • Ok in that case creat custom dialog with custom layout and in your layout try to do as i sujested in my answer with guidlines.This should work

    – Tamir Abutbul
    Mar 10 at 14:01















0














Your question is not so clear to me but if you want the recyclerView to take all of the screen space you should use this :



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>


If you want to limit your recyclerview height I would not recommend using fixed sized in dp - use guideline/barrier to make your recyclerView take only some percent of the screen, for example if you want your view only take 30% of your screen use guidelines with 30% different and constrain your view to them like this:



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toTopOf="@+id/guideline3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline2" />

</androidx.constraintlayout.widget.ConstraintLayout>





share|improve this answer























  • i want to add recycler view inside dialog. i used recycler view height as wrap content . when lot of items have dialog height so big. when recycler view height goes more than 400dp (as a example) it should be stopped (i mean height) . then other item to view scroll down. But i used max width in recycler view it didn't work. Also i created a constraint layout and add recycler view inside it and set height to 0dp . it didn't worked

    – Nimantha
    Mar 10 at 13:24












  • This is not a good practice(the fixed sizes), what is wrong with my answer? why not use constraint layout with guidelines like the example I gave?

    – Tamir Abutbul
    Mar 10 at 13:26











  • didn't work bro. ( I used recycler view in dialog) it could be the reason this method didn't work....

    – Nimantha
    Mar 10 at 13:54











  • Ok in that case creat custom dialog with custom layout and in your layout try to do as i sujested in my answer with guidlines.This should work

    – Tamir Abutbul
    Mar 10 at 14:01













0












0








0







Your question is not so clear to me but if you want the recyclerView to take all of the screen space you should use this :



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>


If you want to limit your recyclerview height I would not recommend using fixed sized in dp - use guideline/barrier to make your recyclerView take only some percent of the screen, for example if you want your view only take 30% of your screen use guidelines with 30% different and constrain your view to them like this:



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toTopOf="@+id/guideline3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline2" />

</androidx.constraintlayout.widget.ConstraintLayout>





share|improve this answer













Your question is not so clear to me but if you want the recyclerView to take all of the screen space you should use this :



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>


If you want to limit your recyclerview height I would not recommend using fixed sized in dp - use guideline/barrier to make your recyclerView take only some percent of the screen, for example if you want your view only take 30% of your screen use guidelines with 30% different and constrain your view to them like this:



 <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewItems"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toTopOf="@+id/guideline3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline2" />

</androidx.constraintlayout.widget.ConstraintLayout>






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 8 at 7:20









Tamir AbutbulTamir Abutbul

1,9482822




1,9482822












  • i want to add recycler view inside dialog. i used recycler view height as wrap content . when lot of items have dialog height so big. when recycler view height goes more than 400dp (as a example) it should be stopped (i mean height) . then other item to view scroll down. But i used max width in recycler view it didn't work. Also i created a constraint layout and add recycler view inside it and set height to 0dp . it didn't worked

    – Nimantha
    Mar 10 at 13:24












  • This is not a good practice(the fixed sizes), what is wrong with my answer? why not use constraint layout with guidelines like the example I gave?

    – Tamir Abutbul
    Mar 10 at 13:26











  • didn't work bro. ( I used recycler view in dialog) it could be the reason this method didn't work....

    – Nimantha
    Mar 10 at 13:54











  • Ok in that case creat custom dialog with custom layout and in your layout try to do as i sujested in my answer with guidlines.This should work

    – Tamir Abutbul
    Mar 10 at 14:01

















  • i want to add recycler view inside dialog. i used recycler view height as wrap content . when lot of items have dialog height so big. when recycler view height goes more than 400dp (as a example) it should be stopped (i mean height) . then other item to view scroll down. But i used max width in recycler view it didn't work. Also i created a constraint layout and add recycler view inside it and set height to 0dp . it didn't worked

    – Nimantha
    Mar 10 at 13:24












  • This is not a good practice(the fixed sizes), what is wrong with my answer? why not use constraint layout with guidelines like the example I gave?

    – Tamir Abutbul
    Mar 10 at 13:26











  • didn't work bro. ( I used recycler view in dialog) it could be the reason this method didn't work....

    – Nimantha
    Mar 10 at 13:54











  • Ok in that case creat custom dialog with custom layout and in your layout try to do as i sujested in my answer with guidlines.This should work

    – Tamir Abutbul
    Mar 10 at 14:01
















i want to add recycler view inside dialog. i used recycler view height as wrap content . when lot of items have dialog height so big. when recycler view height goes more than 400dp (as a example) it should be stopped (i mean height) . then other item to view scroll down. But i used max width in recycler view it didn't work. Also i created a constraint layout and add recycler view inside it and set height to 0dp . it didn't worked

– Nimantha
Mar 10 at 13:24






i want to add recycler view inside dialog. i used recycler view height as wrap content . when lot of items have dialog height so big. when recycler view height goes more than 400dp (as a example) it should be stopped (i mean height) . then other item to view scroll down. But i used max width in recycler view it didn't work. Also i created a constraint layout and add recycler view inside it and set height to 0dp . it didn't worked

– Nimantha
Mar 10 at 13:24














This is not a good practice(the fixed sizes), what is wrong with my answer? why not use constraint layout with guidelines like the example I gave?

– Tamir Abutbul
Mar 10 at 13:26





This is not a good practice(the fixed sizes), what is wrong with my answer? why not use constraint layout with guidelines like the example I gave?

– Tamir Abutbul
Mar 10 at 13:26













didn't work bro. ( I used recycler view in dialog) it could be the reason this method didn't work....

– Nimantha
Mar 10 at 13:54





didn't work bro. ( I used recycler view in dialog) it could be the reason this method didn't work....

– Nimantha
Mar 10 at 13:54













Ok in that case creat custom dialog with custom layout and in your layout try to do as i sujested in my answer with guidlines.This should work

– Tamir Abutbul
Mar 10 at 14:01





Ok in that case creat custom dialog with custom layout and in your layout try to do as i sujested in my answer with guidlines.This should work

– Tamir Abutbul
Mar 10 at 14:01

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057956%2fwhy-recycler-view-max-height-doesnt-work-also-i-tried-recycler-view-add-inside%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page