Questions tagged [layout-anchor]

35 questions
31
votes
5 answers

How to update swift Layout Anchors?

Trying to find a solution to update multiple constraints for multiple UI elements on an event. I have seen some examples of deactivating, making a change, then reactivating constraints, this method seems impractical for the 24 anchors I am working…
Justin
  • 717
  • 1
  • 9
  • 15
11
votes
2 answers

FloatingActionButton, layout_anchor and layout_gravity

A bit of a newbie here. I'm about two months into Android development, but I have years of development experience in other environments. Okay. I have a FloatingActionButton which was not showing up where I expected it or wanted it. It's inside a…
7
votes
1 answer

Creating subviews using layout anchors programmatically

I've created a UIView programmatically using layout anchors. Now I want to add a UILabel inside this view. Here is my code so far : let centerView = UIView() centerView.translatesAutoresizingMaskIntoConstraints = false centerView.backgroundColor =…
halapgos1
  • 1,130
  • 4
  • 16
  • 34
5
votes
3 answers

Floating action button layout anchor not working

I want a floating action button in between my two relative layouts. For this I have taken parent layout as coordinator layout and specified the anchor and anchor gravity to fab button. But its not getting set where I want it to be. I want it to set…
Sid
  • 2,792
  • 9
  • 55
  • 111
5
votes
3 answers

How can I use QML Layouts to arrange aspect ratio scaled items in a grid?

I have rectangles with a certain aspect ratio and rectangles with the inverse aspect ratio. I would like to arrange them in a grid layout of my choosing (doesn't need to be a regular grid, on the contrary: I'd prefer a solution where I can build up…
rubenvb
  • 74,642
  • 33
  • 187
  • 332
3
votes
1 answer

How to update anchor constraint in swift

I would like to create a menu like android in iOS. I'm using layout constraints to setup constraints. I'm facing the issue when I'm trying to update the left constraint of an image on button click (It should animate to clicked button's position).…
Damodar
  • 707
  • 2
  • 10
  • 23
3
votes
0 answers

CoordinateLayout app:layout_anchor and app:layout_anchorGravity not working in fragments

I'm using CoordinateLayout in fragment's layout file. There I need to use FloatingActionButton or ImageButton between two layouts. I got sample code from this answer. I created two fragments with two same layout file. fragment1.xml, fragment2.xml…
AvisSiva
  • 707
  • 1
  • 9
  • 17
3
votes
1 answer

In Swift, how to use Layout Anchor to set multiple subviews to have the same width (no constant)?

For example, I have a parent view that contains 3 subviews. I am using Layout Anchor programatically and try to achieve following layout |--subview 1--|--subview 2--|--subview 3--| Each of the three subviews has equal width. In other…
Joe Huang
  • 6,296
  • 7
  • 48
  • 81
2
votes
2 answers

What the extra width and height constraints appears at programmatically creating UILabel? And how can I prevent theirs creating?

I creates UI element in my application programmatically, eg: override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let label = UILabel() label.text = "Just text" label.backgroundColor = #colorLiteral(red:…
General Failure
  • 2,421
  • 4
  • 23
  • 49
2
votes
1 answer

How do I dynamically adjust the height of a UIView when a member stack view is no longer shown?

I am super new iOS development and StackViews in general and need help calculating dynamic height in instances where a stack view will not be shown. There are cases where certain elements will not be shown depending on what I get back from the…
Aetherynne
  • 113
  • 3
  • 8
1
vote
2 answers

AnchorEL component is invalid after a method is called the first time

I'm currently struggling with anchorRef and I'm not entirely sure how it works because I'm new to react and have never used it before. So I receive this error from material UI the moment the onClickAway method is called which just sets the anchorRef…
J.Naude
  • 125
  • 1
  • 4
  • 11
1
vote
1 answer

How to get the distance between two anchors?

I know how to get the distance between two points in swift. But I want to know how to get the distance between two anchors as a CGFloat. For example: I want to find the distance between the view.topAnchor and the button.topAnchor on a view…
Slaknation
  • 2,124
  • 3
  • 23
  • 42
1
vote
1 answer

Removing the blank spaces on left and right side of the UISearchBar

I am creating a UI component that should display a UILabel and a UISearchBar below. However, I am not able to align them, the UISearchBar always has extra space on both left and right side (highlighted RED). I was trying to set the dimensions of…
Peter G.
  • 7,816
  • 20
  • 80
  • 154
1
vote
1 answer

ImageView not resizing to AnchorPane in JavaFX SceneBuilder/Layout XML

I'm having trouble with layout in JavaFX SceneBuilder. I have a GridPane, one cell of which contains an ImageView inside an AnchorPane, and want the image to resize to the anchor. I tried this, but it doesn't work. Just shows the image at full…
user1300214
1
vote
1 answer

ios setting anchor from XIB table not working properly

I have some widgets defined in an XIB, I want to set the constrains-anchors programatically. When I set an imageView seems to work, but a UITable is disappearing when left, right or bottom anchors are set. Also the table is not setting Y position…
manuelBetancurt
  • 15,428
  • 33
  • 118
  • 216
1
2 3