android-constraintlayout

AndroidX migration - data binding error msg:Cannot find the setter for attribute 'android:visibility' with parameter type int

醉酒当歌 提交于 2021-02-20 04:42:45
问题 I'm migrating a project to AndroidX and have the following error : Caused by: java.lang.RuntimeException: android.databinding.tool.util.LoggedErrorException: Found data binding errors. ****/ data binding error ****msg:Cannot find the setter for attribute 'android:visibility' with parameter type int on androidx.constraintlayout.ConstraintLayout And the layout having the issue is : <androidx.constraintlayout.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap

How to proper align three TextViews horizontally with ConstraintLayout

故事扮演 提交于 2021-02-18 12:39:43
问题 I'm trying to align three TextViews horizontally (as the title may suggest), but even after chaining they together and using app:layout_constrainedWidth="true" they're still being pushed out of the screen, strangely only by the left side when the middle or the last one grows large. Notice that I'm setting the android:maxLines="1" and android:ellipsize="end" and aligning they at the start of the screen, not sure if it matters though. I also tried to limit their sizes, but on the case where

ConstraintLayout max width percentage

▼魔方 西西 提交于 2021-02-17 08:46:24
问题 I've been experimenting with ConstraintLayout, is there a way to set the max width of a view to a percentage of the parent (and a height of match constraint and dimension ratio of 1:1)? Here is the code without using max width: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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">

ConstraintLayout max width percentage

只愿长相守 提交于 2021-02-17 08:46:12
问题 I've been experimenting with ConstraintLayout, is there a way to set the max width of a view to a percentage of the parent (and a height of match constraint and dimension ratio of 1:1)? Here is the code without using max width: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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">

Change height percentage based on another view's height in ConstraintLayout

隐身守侯 提交于 2021-02-11 16:14:20
问题 I have a view defined as <View android:id="@+id/guideLayout" android:visibility="invisible" app:layout_constraintBottom_toTopOf="@+id/signupBtn" app:layout_constraintTop_toBottomOf="@+id/balanceText" android:layout_width="0dp" android:layout_height="0dp"/> The view basically extends itself above a signupBtn and below a balanceText I want to add a new textView whose height is equal to a percentage of its view. Currently I am doing this <TextView android:layout_marginTop="21dp" app:layout

Change height percentage based on another view's height in ConstraintLayout

痴心易碎 提交于 2021-02-11 16:12:42
问题 I have a view defined as <View android:id="@+id/guideLayout" android:visibility="invisible" app:layout_constraintBottom_toTopOf="@+id/signupBtn" app:layout_constraintTop_toBottomOf="@+id/balanceText" android:layout_width="0dp" android:layout_height="0dp"/> The view basically extends itself above a signupBtn and below a balanceText I want to add a new textView whose height is equal to a percentage of its view. Currently I am doing this <TextView android:layout_marginTop="21dp" app:layout

How to move a view (button) programmatically in a constraint layout?

徘徊边缘 提交于 2021-02-11 14:26:39
问题 I'm trying to create a simple timetable, (I'm a beginner). I have created a basic layout for the timetable with 7 days and 24 hours, and my idea was to insert buttons programmatically, overlaying the timetable for the correct time and duration by manipulating the position and width of the buttons, so that when clicked they display the task saved in the textview below as such: I know how to create the buttons but after hours of searching for a working method to change their size and location

Why my dialog layout wont spread correctly?

心已入冬 提交于 2021-02-11 12:35:05
问题 In my layout (its layout for custom dialog class), whenever I set my layout attributes like this : android:layout_width="match_parent" android:layout_height="match_parent" I don't see a layout that spreads all over the screen, I see it like this: As you can see, the dialog is very small and weird looking although I am using match_parent , the weird part is that whenever I use fixed size I see it normally. For example - for those attributes: android:layout_width="300dp" android:layout_height=

Why my dialog layout wont spread correctly?

心不动则不痛 提交于 2021-02-11 12:34:09
问题 In my layout (its layout for custom dialog class), whenever I set my layout attributes like this : android:layout_width="match_parent" android:layout_height="match_parent" I don't see a layout that spreads all over the screen, I see it like this: As you can see, the dialog is very small and weird looking although I am using match_parent , the weird part is that whenever I use fixed size I see it normally. For example - for those attributes: android:layout_width="300dp" android:layout_height=

How to set RecyclerView item max height relative to parent

被刻印的时光 ゝ 提交于 2021-02-10 17:58:46
问题 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