android-constraintlayout

Constraint layout button text center alignment

旧城冷巷雨未停 提交于 2019-12-22 06:50:07
问题 I'm using the new Constraint layout to build my layout. I need to have Button that occupies almost the entire screen width and that was easy using constraints. As you can see in the image I am setting the width to 0dp (Any size), but the text don't stick at the center what's usually the normal for a button text. I've tried: - set gravity to center - set textAlignment to center Looks like this properties can't work with 0dp width (Any size). So I've tried to set the width to match_parent using

Layout messed up when dialog opens

﹥>﹥吖頭↗ 提交于 2019-12-22 06:46:57
问题 I'm facing a very strange bug with one of layout whose parent is ConstraintLayout. When ever a diaog is open the layout behind automatically start constracting and moving. Please refer attached gif for idea about the bug. Please check my code and see if i'm doing something wrong. Here is my 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

goneMargin is not respected in a wrap_content ConstraintLayout?

吃可爱长大的小学妹 提交于 2019-12-22 05:08:14
问题 I have a ConstraintLayout where its height is wrap_content . I want its height to be able to collapse or expanding, according to its Child's height. Simple and common enough, right? Now I have a layout which looks like this: (First of all, please ignore the abnormal super large margin at the bottom. As you can see, the margin is just 16dp but the preview renders a very large margin.) My problem is, if the big rectangle's visibility is set to gone , According to the documentation of

Android - Constraint layout - How to align a view centered over edge of other view?

假装没事ソ 提交于 2019-12-22 03:56:38
问题 I want to build a layout like this: Inside the constraint layout there is an Image View which acts like a banner, then there is a Card that is center aligned with the bottom edge of the banner and then there is another Image View that is center aligned with the top edge of the card. The problem I am facing is that the second Image View (GREEN one) when aligned with the card goes in the background instead of staying in the foreground. Here is the xml, <android.support.constraint

android ConstraintLayout does not allow negative margins

一世执手 提交于 2019-12-22 03:35:33
问题 I position lots of items relative to a layout guide, and would like to position a new item nearly relative to this layout guide. I tried with a negative layout margin without success. 回答1: Here is a blog posting that discusses negative margins in ConstraintLayout . Using Spaces for negative margins A view in a ConstraintLayout cannot have negative margins (it’s not supported). However, with an easy trick you can have similar functionality by inserting a Space (which is essentially an empty

Cannot set visibility on individual items in a ConstraintLayout.Group

╄→гoц情女王★ 提交于 2019-12-21 09:25:01
问题 I have a ConstraintLayout.Group defined like this: <android.support.constraint.Group android:id="@+id/someGroup" android:layout_width="wrap_content" android:layout_height="wrap_content" app:constraint_referenced_ids=" textView1, textView2, button1" /> I change the visibility of this group from GONE to VISIBLE: someGroup.visibility = VISIBLE But when I try to override it by specifying the visibility of one of the views in that group: button1.visibility = GONE ...it doesn't work. I log this

Color of TextView shows as white on a real device with ConstraintLayout

懵懂的女人 提交于 2019-12-21 09:16:01
问题 I have been trying my hands on ConstraintLayout and so far I have liked it a lot except now I have run into a peculiar problem. The same layout, if I design using a RelativeLayout displays the color of the contained TextView s as the default text color(greyish) but with ConstraintLayout , it shows white. This happens on both a real device as well as an emulator with Android 5.0 but not on emulator(7.0). Does anyone know, why might this be happening? Also, the obvious solution seems to be

How to create accessible focus groups in ConstraintLayout?

只愿长相守 提交于 2019-12-21 03:18:33
问题 Imagine you have a LinearLayout inside a RelativeLayout that contains 3 TextViews with artist, song and album : <RelativeLayout ... <LinearLayout android:id="@id/text_view_container" android:layout_width="warp_content" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@id/artist" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Artist"/> <TextView android:id="@id/song" android:layout_width="wrap_content" android

Trying to replicate GridLayout column alignment with ConstraintLayout

為{幸葍}努か 提交于 2019-12-20 17:31:57
问题 I'm new to ConstraintLayout, and I'm trying to replicate the same grid behavior offered by GridLayout with ConstraintLayout. Specifically, I want to design a two columns grid. The first column width should be as narrow as possible, while the second column should take all the remaining horizontal space. Of course, the second column should be just to the right of the first column, or rather, to the widest view on the first column. I don't know how can I replicate this last requirement with

Trying to replicate GridLayout column alignment with ConstraintLayout

丶灬走出姿态 提交于 2019-12-20 17:31:43
问题 I'm new to ConstraintLayout, and I'm trying to replicate the same grid behavior offered by GridLayout with ConstraintLayout. Specifically, I want to design a two columns grid. The first column width should be as narrow as possible, while the second column should take all the remaining horizontal space. Of course, the second column should be just to the right of the first column, or rather, to the widest view on the first column. I don't know how can I replicate this last requirement with