-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix linear layout size calculation to properly account for item margi…
…ns (#1469) * Better margin handling in WeightlessLinearLayout * Add margin debugging layouts
- Loading branch information
Showing
3 changed files
with
414 additions
and
10 deletions.
There are no files selected for viewing
197 changes: 197 additions & 0 deletions
197
urbanairship-layout/playground/sample-layouts/linear-layout-margins-horizontal.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
--- | ||
version: 1 | ||
presentation: | ||
dismiss_on_touch_outside: true | ||
type: modal | ||
default_placement: | ||
size: | ||
width: 95% | ||
height: 30% | ||
shade_color: | ||
default: | ||
hex: '#000000' | ||
alpha: 0.7 | ||
view: | ||
type: container | ||
background_color: | ||
default: | ||
hex: "#ffffff" | ||
alpha: 1 | ||
border: | ||
stroke_color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
stroke_width: 3 | ||
items: | ||
# TOP-LEVEL LINEAR LAYOUT | ||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
height: 100% | ||
width: 100% | ||
view: | ||
type: linear_layout | ||
direction: vertical | ||
background_color: | ||
default: | ||
hex: "#ffffff" | ||
alpha: 0.35 | ||
items: | ||
- size: | ||
width: 100% | ||
height: 50% | ||
view: | ||
type: linear_layout | ||
direction: horizontal | ||
items: | ||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 0 | ||
end: 0 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#FF0000" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
|
||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 0 | ||
end: 0 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#00FF00" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
|
||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 0 | ||
end: 0 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#0000FF" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
- size: | ||
width: 100% | ||
height: 50% | ||
view: | ||
type: linear_layout | ||
direction: horizontal | ||
items: | ||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 16 | ||
end: 16 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#FF0000" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
|
||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 16 | ||
end: 16 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#00FF00" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
|
||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 16 | ||
end: 16 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#0000FF" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 |
197 changes: 197 additions & 0 deletions
197
urbanairship-layout/playground/sample-layouts/linear-layout-margins-vertical.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
--- | ||
version: 1 | ||
presentation: | ||
dismiss_on_touch_outside: true | ||
type: modal | ||
default_placement: | ||
size: | ||
width: 95% | ||
height: 30% | ||
shade_color: | ||
default: | ||
hex: '#000000' | ||
alpha: 0.7 | ||
view: | ||
type: container | ||
background_color: | ||
default: | ||
hex: "#ffffff" | ||
alpha: 1 | ||
border: | ||
stroke_color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
stroke_width: 3 | ||
items: | ||
# TOP-LEVEL LINEAR LAYOUT | ||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
height: 100% | ||
width: 100% | ||
view: | ||
type: linear_layout | ||
direction: horizontal | ||
background_color: | ||
default: | ||
hex: "#ffffff" | ||
alpha: 0.35 | ||
items: | ||
- size: | ||
width: 50% | ||
height: 100% | ||
view: | ||
type: linear_layout | ||
direction: vertical | ||
items: | ||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 0 | ||
end: 0 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#FF0000" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
|
||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 0 | ||
end: 0 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#00FF00" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
|
||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
start: 0 | ||
end: 0 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#0000FF" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
- size: | ||
width: 50% | ||
height: 100% | ||
view: | ||
type: linear_layout | ||
direction: vertical | ||
items: | ||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
top: 16 | ||
bottom: 16 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#FF0000" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
|
||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
top: 16 | ||
bottom: 16 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#00FF00" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 | ||
|
||
- position: | ||
horizontal: center | ||
vertical: center | ||
size: | ||
width: 100% | ||
height: 100% | ||
margin: | ||
top: 16 | ||
bottom: 16 | ||
view: | ||
type: label | ||
text: 100% | ||
background_color: | ||
default: | ||
hex: "#0000FF" | ||
alpha: 0.35 | ||
text_appearance: | ||
color: | ||
default: | ||
hex: "#000000" | ||
alpha: 1 | ||
alignment: center | ||
font_size: 12 |
Oops, something went wrong.