【问题标题】:Nativescript how to overflow hidden childNativescript如何溢出隐藏的孩子
【发布时间】:2017-06-12 19:54:56
【问题描述】:

我正在尝试创建一个使用边框半径来包裹其子项的布局,但我无法在包含边框半径的父项中隐藏子项内容。

在网络上可以使用overflow: hidden 完成,但是在 NativeScript 上我无法做到,这是我的css

.card {
    border-radius: 10;
    border-color: blue;
    border-width: 1;
    margin-bottom: 16;
    overflow: hidden;
}

<StackLayout *ngFor="let item of petLista" class="card">
    <StackLayout class="card_image"></StackLayout>
    <StackLayout class="card_info">
        // ... more content here
    </StackLayout>
</StackLayout>

但是在运行应用程序时,结果是这样的:

我需要做什么才能将内容包裹在父级中以跟随半径?

【问题讨论】:

  • 您找到解决方案了吗?

标签: nativescript angular2-nativescript


【解决方案1】:

您可能想尝试在类为card 的父容器上将clipToBounds 设置为true

https://docs.nativescript.org/api-reference/classes/_ui_layouts_layout_.layout.html#cliptobounds

【讨论】:

  • 它没有用。我正在android上测试它。知道为什么吗?
  • 您是否收到错误或任何其他消息?或者,也许尝试将它放在子元素上?
  • 不,完全没有错误。我也试过把它放在孩子身上,但它也没有效果。
  • 我可能已经告诉你错了,可能是 clipToBounds 错误
  • 它不起作用,在 iOS 中,当您使用border-radius 时,子元素不会从容器中溢出,但在 android 中它会溢出,无论您是否在具有边框半径的元素
猜你喜欢
  • 2021-06-10
  • 2020-02-20
  • 1970-01-01
  • 2011-03-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-02
相关资源
最近更新 更多