2017-06-10 59 views
0

我試圖創建一個使用邊框半徑來包裝它的孩子的佈局,但我無法隱藏包含邊框半徑的父級內的子內容。Nativescript如何溢出隱藏的孩子

在網絡上,他們將採用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> 

但在運行應用程序時,這是結果:

enter image description here

什麼我需要做的包父中的內容跟隨半徑?

回答

0

你可能想嘗試設置clipToBounds父容器上等於真與類的card

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

+0

它並沒有奏效。我在android上測試它。任何想法爲什麼? – celsomtrindade

+0

您是否收到錯誤或其他消息?或者,也許嘗試把它放在孩子的元素? – theOriginalJosh

+0

不,完全沒有錯誤。我也嘗試把它放在孩子身上,但它也沒有效果。 – celsomtrindade