Skip to content

Commit a23c8bd

Browse files
authored
fix(android): Label now defaults to vertical-align middle (#10233)
closes #3829 #5977 #8216
1 parent a19568c commit a23c8bd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

apps/toolbox/src/pages/labels.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
</Page.actionBar>
66
<ScrollView>
77
<StackLayout padding="20">
8-
<Label text="maxLines 2" fontWeight="bold" />
8+
<GridLayout borderWidth="1" borderColor="#efefef" height="60" paddingLeft="5">
9+
<Label text="Test Label 1: should be aligned middle" />
10+
</GridLayout>
11+
<GridLayout marginTop="10" borderWidth="1" borderColor="#efefef" height="60" paddingLeft="5">
12+
<Label text="Test Label 2: should be aligned bottom" verticalAlignment="bottom" />
13+
</GridLayout>
14+
<GridLayout marginTop="10" borderWidth="1" borderColor="#efefef" height="60" paddingLeft="5">
15+
<Label text="Test Label 3: should be aligned top" verticalAlignment="top" />
16+
</GridLayout>
17+
<Label text="maxLines 2" fontWeight="bold" marginTop="10" />
918
<Label
1019
text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
1120
textWrap="true"

packages/core/ui/label/index.android.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class Label extends TextBase implements LabelDefinition {
3939
const textView = this.nativeTextViewProtected;
4040
textView.setSingleLine(true);
4141
textView.setEllipsize(android.text.TextUtils.TruncateAt.END);
42+
textView.setGravity(android.view.Gravity.CENTER_VERTICAL);
4243
}
4344

4445
[whiteSpaceProperty.setNative](value: CoreTypes.WhiteSpaceType) {

0 commit comments

Comments
 (0)