How would I get a RecyclerView's item height to be, say, 30% of the screen's height?
I can't simply use a ConstraintLayout or a PercentFrameLayout/PercentRelativeLayout, since those position child layouts relative to parent layouts, whose size might not match the screens.
Preferably, I'd like to do this in pure XML (and not have to use any Runnables to get the screen height dynamically).
EDIT
To clarify, since a lot of solutions suggest restraining the height of the RecyclerView, that's not the intent. The RecyclerView should still populate the screen. Here's what I'm talking about, using the screen width (instead of height):
The idea is to get the card's width to be 33% the screen's width, while keeping the RecyclerView's width unaltered as it scrolls past the screen horizontally.
question from:
https://stackoverflow.com/questions/51201482/android-percent-screen-width-in-recyclerview-item 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…