我是新来的nativescript。我不知道如何给stacklayout指定边框和边框半径。
以下是我目前所做的努力:
组件.html:
<StackLayout class ="stackBorder" orientation="horizontal">
<Label text="Label 1" width="50" height="50" > </Label>
<Label text="Label 2" width="50" height="50" > </Label>
<Label text="Label 3" width="50" height="50" backgroundColor="white"> </Label>
<Label text="Label 4" width="50" height="50" backgroundColor="white"> </Label>
</StackLayout>
组件.css:
StackLayout {
margin: 10;
background-color: green;
}
.stackBorder {
border: 2px solid red;
border-radius: 8px;
}
组件.ts:
@Component({
selector: "sdk-child-component",
moduleId: module.id,
templateUrl: "./component.html",
styleUrls: ["./component.css"]
})
最后我在stacklayout中看不到边界。
最佳答案
在nativescript中,支持的css属性包括边框宽度、边框颜色和边框半径。不能单独使用标记边框,也不能选择任何实体。
更多信息:
https://docs.nativescript.org/ui/styling