android-constraintlayout

How can I use ConstraintLayout to have the first View shrink to fit remaining space?

删除回忆录丶 提交于 2019-12-10 09:27:04
问题 I have the following layout. Notice Z is positioned below Y , but constrained to the bottom. There is a nice gap gap between Y and Z , afforded by the excess vertical space. This is my desired and actual behavior when there is excess vertical space . However, I run out of excess vertical space when the keyboard is shown. Desired Behavior (no excess vertical space) When I run out of vertical space, I would like the following to occur: X ( ScrollView ), shrinks to fill the remaining space,

Getting “Error: Missing Constraints in ConstraintLayout”

妖精的绣舞 提交于 2019-12-10 02:36:54
问题 I am using Android Studio 3.0.1. Whenever I drag button or do any other activity on my Activity Screen it gives me the following error Missing Constraints in ConstraintLayout" I need a permanent fix for this issue. Please help me. 回答1: See in the pallete just above your design you will see a wand type tool, when you will hover over it it will show infer constraint , just click on it and your problem will be solved 回答2: Go to the text view in your .xml file hover the cursor to the Error part

ConstraintLayout: What does `layout_constraintLeft_creator` do in xml?

点点圈 提交于 2019-12-09 02:26:25
问题 Example code: <EditText android:id="@+id/msg_type" android:layout_width="0dp" android:layout_height="40dp" android:layout_marginBottom="8dp" android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:hint="Input message" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintHorizontal_bias="0.75" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toLeftOf="@+id/btn_chat_send" tools:layout_constraintBottom_creator="1" tools:layout_constraintLeft

Use Android's ConstraintLayout to create table-like view

你离开我真会死。 提交于 2019-12-08 13:23:58
问题 all. What I am trying to achieve in its simplest form is to pack 4 View s in two rows packed 2 by 2. Each row contains 1 ImageView and 1 TextView without putting any fixed dimensions for the ImageView and allowing the TextView to have multiple lines without ellipsis. Any of both can be taller than the other. The aim is to have each of the horizontal pairs of image and text horizontally aligned and taking as low vertical space as possible. This is easily achievable using two horizontal

Can we use OnSwipe and OnClick in the same <Transition> for Android MotionLayout?

一笑奈何 提交于 2019-12-08 11:46:26
问题 I want to play animation when user clicks or swipes . But can we handle both behaviours in MotionLayout? They work separately perfectly, but if I add OnClick and OnSwipe in the same scene, only OnClick works. Is there any workarounds? 回答1: Sure, just handle the onTouch event in your parent class. Then decide what you are doing with it and what to send it to. onTouch(touchEvent){ motionLayout.doClickIfYouWant(touchEvent) motionLayout.doSwipeIfYouWant(touchEvent) } Pseudo code, but you can send

Is Constraint Layout expensive compared to others?

喜夏-厌秋 提交于 2019-12-07 23:50:45
问题 When I realize ConstraintLayout has: better layout drag-drop better view relative set-up with better naming "top-toBottomOf" better layout construction with ratios and percentage-guidelines and much more cant state here or I just didn't know that I was always wanted to using it constantly because it is so comfortable.   Just like the title, I curious about did ConstraintLayout will give big performance impact when using it constantly? Statement your opinion and evidence will be appreciated.

ConstraintLayout not wrapping content

China☆狼群 提交于 2019-12-07 11:59:25
问题 I have a constraintLayout inside a cardview. Buttons are arranged in grid format as shown in picture. But for some reason whitespace is displayed below buttons. I want to remove this whitespace. Here is xml code <android.support.v7.widget.CardView android:id="@+id/cvSpecialisations" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="8dp" app:cardElevation="2dp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app

Add view to constraintLayout with constraints similar to another child

亡梦爱人 提交于 2019-12-07 11:17:34
问题 I have a constraint layout (alpha9) with views spread all over it, and I have one particular ImageView that I need to replicate and add more of like it. The layout is like so : The main purpose is to animate 5 of those "coin" imageViews when the button is pressed. The imageViews i need to generated sha'll have exact properties of the the imageView behind the Button down below (with same constraints) What i tried to do is the following : private ImageView generateCoin() { ImageView coin = new

How to use ConstraintSet for animation in Android with Java?

。_饼干妹妹 提交于 2019-12-07 06:53:39
问题 I find that there is a quick way to create animation with ConstraintSet for ConstrainLayout Activity. Faster than use TransitionManager for RelativeLayout ConstraintSet use two xml file for an Activity. One for the first position and next one for the destination. I want to create something like this: https://media.giphy.com/media/2UwXdWEoLWe9iQMFIY/giphy.gif But there is no clearly instruction show how to use it in Java. Anyone had done this can show me the source code or link to some post

Android ConstraintLayout: How to add a dynamic view one below another

爷,独闯天下 提交于 2019-12-07 06:01:16
问题 I am trying to add TextViews one below another at runtime in a Constraint Layout. But I always end up with just one textview and the rest hiding behind it. I tried several things including chaining the view, but nothing seems to work. private void method(int position) { ConstraintSet set = new ConstraintSet(); TextView textView = new TextView(getContext()); int textViewId = 100 + position; //previousTextViewId = textViewId; textView.setId(textViewId); ConstraintLayout.LayoutParams