NativeScript在动态网格中显示图像

时间:2018-06-30 18:28:18

标签: image listview gallery nativescript stackview

我正在尝试找到一种以两列和三行显示6张图像的方法。 用于列和图像的应为50%。这是我的代码,它不会“溢出”第二和第三行。

HTTP/1.0 200 OK Cache-Control: public Content-Disposition: inline; filename="Real_Estate_Test.pdf" Date: Sat, 30 Jun 2018 18:21:48 GMT Last-Modified: Sat, 30 Jun 2018 18:21:48 GMT

我找到了一种完美的解决方案<Repeater items="{{ sviKatalozi }}"> <Repeater.itemsLayout> <StackLayout orientation="horizontal" width="500" height="1000" /> </Repeater.itemsLayout> <Repeater.itemTemplate> <Image width="180" margin="10" src="{{ 'http://imageurl' + katalog_image }}" /> </Repeater.itemTemplate> </Repeater> ,以我想要的方式安排事物,但是找不到使用可观察变量和数据绑定的方法。如果将<FlexboxLayout>放入其中,则无法使用。

items="{{ sviKatalozi }}"

有什么办法可以使这项工作吗?谢谢

1 个答案:

答案 0 :(得分:0)

像这样使用ngFor

<GridLayout *ngFor="let item of placesArray" width="50%" class="placeBox">

代替中继器