android-constraintlayout

Layout messed up when dialog opens

心已入冬 提交于 2019-12-05 08:43:19
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/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="

goneMargin is not respected in a wrap_content ConstraintLayout?

廉价感情. 提交于 2019-12-05 04:19:11
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 ConstraintLayout , if I set its goneMarginTop to a certainValue, it will retain that margin even when its

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

亡梦爱人 提交于 2019-12-05 02:22:54
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.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows=

android ConstraintLayout does not allow negative margins

断了今生、忘了曾经 提交于 2019-12-05 01:37:31
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. 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 View) and setting its size to the margin you want. android:translationX="-10dp" android:translationY="-10dp"

How to use layout_aspectRatio in the PercentRelativeLayout?

送分小仙女□ 提交于 2019-12-04 23:55:09
I try to achieve a 16:9 aspect ratio on a view with the PercentRelativeLayout . So I have put this line in my build.gradle file: compile 'com.android.support:design:23.0.1' I use this layout: <android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="match_parent" app:layout_aspectRatio="178%" android:scaleType="centerCrop"/> </android.support.percent.PercentRelativeLayout> Problems: Android

How to mimick Weighted LinearLayout with a Constraint Layout

你离开我真会死。 提交于 2019-12-04 21:34:21
问题 How can we spare space equally in a Constraint Layout as in LinearLayout? For instance, how would the below layout become if it was written with constraints? <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:id="A" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> <TextView android:id="B" android:layout_width="0dp" android:layout_height="wrap_content" android

Which LayoutManager for the animations of a 2048 game?

a 夏天 提交于 2019-12-04 20:18:00
问题 For training purposes, I am currently replicating the 2048 game. I got the logic and interaction done, but print (and simply refresh) it inside a single TextView which looks ridiculous, of course. When thinking about how to build a UI for the game, I am uncertain which LayoutManager to choose. What I need to be doing in the game's 4 x 4 grid is to merge and add cells inside rows and columns with animation . It seems to me that: GridLayout won't work since it is dealing with the full dataset

ConstraintLayout: set height of all views in row to match the tallest one

本小妞迷上赌 提交于 2019-12-04 16:02:31
问题 I'm trying to utilize a ConstraintLayout (version 1.0.2) to set the height of 2 side-by-side views to match the tallest one of them. This serves as a ViewHolder in for a RecyclerView, where each TextView gets an arbitrary length of text... If I set each to wrap_content, the shorter one will shrink. If I set both to 0dp (match_contraints), both end up 0 height. Here's the setup: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas

ConstraintLayout in Cardview adding white space

和自甴很熟 提交于 2019-12-04 12:32:54
I am trying to create a CardView that has a ConstraintLayout to organize some TextView . Sometimes it'll display as intended, but sometimes, it'll add extra white space such as when a keyboard is closed and ruin the layout. I have a GIF below showing the CardView working and not working in the same span of time. A code snippet for the relevant CardView is below. I use wrap_content to try to keep the CardView at the size I want, but it still expands. <android.support.v7.widget.CardView android:id="@+id/cardView_game_cash" android:layout_width="0dp" android:layout_height="wrap_content" android

How to implement ConstraintLayout in NestedScrollView

时光总嘲笑我的痴心妄想 提交于 2019-12-04 11:38:59
问题 ConstraintLayout is behaving inconsistently if a TextView has very fewer texts than other TextView wrapped in horizontal LinearLayout. If a character in left TextView is not much less than right TextView then it is working great. Please refer red color texts and green color texts in attached screenshots. Below is the XML for layout: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:/