Questions tagged [constraintset]

is a class that allows you to define programmatically a set of constraints to be used with ConstraintLayout

[please rename this tag to android-constraintset since it belongs to android.]

30 questions
0
votes
1 answer

Using ConstraintSet with ViewBinding

I can't a programmed button to appear with ConstraintSet when used in conjunction with ViewBinding. It doesn't crash, the button just doesn't appear. I can't work out why. The print statements shows btn is at 0,0 and zero height and width. Before…
Peter
  • 79
  • 7
0
votes
1 answer

Constraint Set problem, Unable to figure out issue

I have extended ConstraintLayout and adding views programatically then setting constraint to each view. but some how its not working, only the first view is showing up. Unable to figure out where I went wrong. addViews(){ titleInfoView = new…
0
votes
1 answer

ConstraintSet how to clear constrainMaxHeight?

I have a ConstraintLayout and I'm adding a maxHeight constraint by using constraintSet.constrainMaxHeight(R.id.recyclerView, (Utils.getScreenHeight() / 2.2).toInt()) Later in my excecution I need to remove this max height constraint, so I…
Lucas P.
  • 4,282
  • 4
  • 29
  • 50
0
votes
0 answers

Dynamically add text views from a list to a constraint layout

running into a bit of a problem. Basically I have a Map(k:string, v:string) and I am trying to add their key-value pairs to text views in a constraint layout, dynamically. The map size can vary so this is why I need to add them dynamically. The…
0
votes
3 answers

Setting constraints programmatically via constraintSet causes views to disappear

Whenever I am connecting two widgets the starting element will no longer show up. Unfortunately I have no idea what's the cause of this problem. The ConstraintLayout myLayout is already inflated within another layout. ConstraintLayout myLayout=…
0
votes
0 answers

Android: change view visibility using ConstraintSet

I would like to change my view visibility using Contarint sets, I create two identical views but in second view I make my view visibility gone, actually when I run my activity it only shows the second XML where view visibility has already gone but…
0
votes
2 answers

ConstraintLayout - Dynamically set constraints

Basic example of multiple ConstrainLayout:
Bugdr0id
  • 2,962
  • 6
  • 35
  • 59
0
votes
1 answer

Modifying ConstraintSet chains programmatically not working as expected

For some reason, when modifying a ConstraintLayout's ConstraintSet programmatically to change a view position (that belongs to a chain), the result is not as expected. In the following example I built a Button With Icon View, where the image can be…
0
votes
1 answer

ConstraintLayout that should support portrait and landscape modes -with a button to toggle full screen

I'm trying to achieve the 4 cases of the image but with no success. Orange square is 40dp and used to toggle full screen. As you can see, in portrait\landscape mode: when orange button is pressed, the screen is toggled between 2 cases. Just take in…
0
votes
1 answer

Programmatically add Button to ConstrainLayout with ConstraintSet

GoodDay everyone. Im trying to add a button programmatically to a ConstraintLayout and set ConstraintSet to such button. The problem comes when I try to close the constraintSet from the layout as the button I've added has no ID. Button button = new…
0
votes
0 answers

beginDelayedTransiton in RecyclerView ViewHolder is ignored

I am trying to animate RecyclerView items using ConstraintSet animation. I have two layouts and they are switched properly using this code: val constraint2 = ConstraintSet() constraint2.clone(binding.root.context, R.layout.list_item_2) val…
0
votes
0 answers

ConstraintLayout animation using ConstraintSet is not working with ScrollView

I have two layouts with ConstraintLayout which has a child NestedScrollview and NestedScrollview have a child ConstraintLayout again as a container than other views. I want animate both layouts using ConstraintSet but unfortunately, this is not…
0
votes
1 answer

clone and applyTo from ConstraintSet making app crashing

I'm trying to create some constraints for a programmatically created ImageView, but when I run the app, it crashes (Unfortunately, pruebaConstraint has stopped. message). As the title says, the crash ocurs when I add the line…
-1
votes
1 answer

How to use ConstraintSet to set what like app:layout_constraintBottom_toBottomOf?

Now,here is my question. how can I use ConstraintSet's connect to set attr like 'app:layout_constraintBottom_toBottomOf="parent"'
1
2