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
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
add a comment |
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
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
add a comment |
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
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
android android-layout android-recyclerview recyclerview-layout
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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" />
thanks, i tried this, but it didn't work. I don't know why....
– Nimantha
Mar 10 at 13:17
add a comment |
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>
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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" />
thanks, i tried this, but it didn't work. I don't know why....
– Nimantha
Mar 10 at 13:17
add a comment |
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" />
thanks, i tried this, but it didn't work. I don't know why....
– Nimantha
Mar 10 at 13:17
add a comment |
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" />
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" />
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
add a comment |
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
add a comment |
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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