android-constraintlayout

How to set RecyclerView item max height relative to parent

徘徊边缘 提交于 2021-02-10 17:55:41
问题 I've almost got this working by following the suggestions in this question Android percent screen width in RecyclerView item However that sets a height for all views, same height regardless of the content. In my case I just want to limit how tall an item inside the RecyclerView can be related to its height. In my RV I have items that have different heights, with some of those items capable of being even taller than the RV. My goal is to tell that the item can be at max 60% of the RecyclerView

How to set RecyclerView item max height relative to parent

核能气质少年 提交于 2021-02-10 17:54:40
问题 I've almost got this working by following the suggestions in this question Android percent screen width in RecyclerView item However that sets a height for all views, same height regardless of the content. In my case I just want to limit how tall an item inside the RecyclerView can be related to its height. In my RV I have items that have different heights, with some of those items capable of being even taller than the RV. My goal is to tell that the item can be at max 60% of the RecyclerView

Constraint Layout - Grouping together layouts in chains

五迷三道 提交于 2021-02-10 03:30:56
问题 I want to create a chain in constraint layout that is spread but keeping the title and the text together, without a gap between them. I am trying to achieve the same view, but without the linear layout and instead a flat constraint layout: <android.support.constraint.ConstraintLayout 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:id="@+id/scrollView3" android:layout_width=

Constraint Layout - Grouping together layouts in chains

早过忘川 提交于 2021-02-10 03:27:42
问题 I want to create a chain in constraint layout that is spread but keeping the title and the text together, without a gap between them. I am trying to achieve the same view, but without the linear layout and instead a flat constraint layout: <android.support.constraint.ConstraintLayout 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:id="@+id/scrollView3" android:layout_width=

Spread-chain group of elements with ConstraintLayout

 ̄綄美尐妖づ 提交于 2021-02-07 13:00:20
问题 I'm having an issue to spread-chain 2 groups of elements with Constraint Layout. I understand the goal of this new layout is to use a flat hierarchy so I'd like to avoid putting my elements inside a child layouts. I looked at some awesome resources like constraintlayout.com but couldn't figure out how to make it work for my specific case - which I think can be common.. Here is an image of what I'd like to achieve. In red, spaces 1, 2 and 3 need to have the same height (just like spread chain)

All items merges to top left in constraint Layout , Android Studio [duplicate]

余生长醉 提交于 2021-02-07 10:55:19
问题 This question already has answers here : ConstraintLayout views in top left corner (5 answers) Closed 3 years ago . I am a beginner this is what it looks when i run my app . i am using latest version of Android studio. having constraint Layout as default here are the screenshots This is what it shows https://drive.google.com/file/d/0B-ydaOiOKnYnOG1oODVoZEtwRzA/view?usp=drivesdk This is what im trying to design https://drive.google.com/file/d/0B-ydaOiOKnYnQ2NKSXdZencxYk0/view?usp=drivesdk Help

ConstraintLayout: Unable to scale image to fit a ratio in RecyclerView

独自空忆成欢 提交于 2021-02-07 05:27:08
问题 I have a recycler view with StaggeredGridLayoutManager. Within in I have custom items/views. Each item is defined as a ConstraintLayout where there is an image which is supposed to have a constant aspect ratio. But the image is to still be able to scale to fit the width of each span. And then the height should be adjusted according to the ratio. But somehow the images are not maintaining the aspect ratio. Here are the xml files and code to create the recycler view: item.xml <?xml version="1.0

ConstraintLayout: Unable to scale image to fit a ratio in RecyclerView

喜夏-厌秋 提交于 2021-02-07 05:27:05
问题 I have a recycler view with StaggeredGridLayoutManager. Within in I have custom items/views. Each item is defined as a ConstraintLayout where there is an image which is supposed to have a constant aspect ratio. But the image is to still be able to scale to fit the width of each span. And then the height should be adjusted according to the ratio. But somehow the images are not maintaining the aspect ratio. Here are the xml files and code to create the recycler view: item.xml <?xml version="1.0

ConstraintLayout: center view on full screen but limit width to not overlap with side views

有些话、适合烂在心里 提交于 2021-02-04 21:40:15
问题 I have a toolbar like component implementation, that I'm having trouble with the layout in all situations. It has a left icon, a title and a right menu/button. I need the title to be centered on the full screen (or at least the full width of the layout) but also to not overlap with the other components. So the width of the title would have to be constrained by the left icon and the right button. I have two intermediary solutions but can't seem to find a way to combine them. One is to center

ConstraintLayout: center view on full screen but limit width to not overlap with side views

大憨熊 提交于 2021-02-04 21:38:59
问题 I have a toolbar like component implementation, that I'm having trouble with the layout in all situations. It has a left icon, a title and a right menu/button. I need the title to be centered on the full screen (or at least the full width of the layout) but also to not overlap with the other components. So the width of the title would have to be constrained by the left icon and the right button. I have two intermediary solutions but can't seem to find a way to combine them. One is to center