Nativescript RadListView在iOS上不可见
我已经用RadListView创建了一个组件,并将其放在应用程序的几个页面上。RadListView位于面板内,RadListView的可见性使用面板标题进行控制。该功能在Android上正常工作,但在iOS(iPhone 5s iOS 11.1)上,RadListView不可见 我尝试过用GridLayout包装RadListView,但是,这不起作用 版本信息:nativescript ui列表视图:^3.5.1,tns核心模块:^3.4.1 组件代码:Nativescript RadListView在iOS上不可见,nativescript,nativescript-telerik-ui,Nativescript,Nativescript Telerik Ui,我已经用RadListView创建了一个组件,并将其放在应用程序的几个页面上。RadListView位于面板内,RadListView的可见性使用面板标题进行控制。该功能在Android上正常工作,但在iOS(iPhone 5s iOS 11.1)上,RadListView不可见 我尝试过用GridLayout包装RadListView,但是,这不起作用 版本信息:nativescript ui列表视图:^3.5.1,tns核心模块:^3.4.1 组件代码: <StackLayout xm
<StackLayout xmlns:lv="nativescript-ui-listview">
<GridLayout rows="*" columns="auto, *, auto" verticalAlignment="top" onTap="EntityHeaderTap" class="entity-header">
<Image row="0" col="0" width="23" src="res://detail_Employee" verticalAlignment="center"/>
<StackLayout row="0" col="1" orientation="horizontal" verticalAlignment="center" marginLeft="10">
<Label id="entityLabel" text="Employee" fontSize="15" verticalAlignment="center" color="#706e77"/>
</StackLayout>
<Image id="entityArrow" row="0" col="2" width="14" src="res://arrow_u" verticalAlignment="center" />
</GridLayout>
<StackLayout id="entityContent" visibility="collapse" class="entity-content">
<lv:RadListView id="employeeListView" items="{{ Employees }}" itemTap="EmployeeItemTap" visibility="{{ Employees ? 'visible' : 'collapsed' }}" selectionBehavior="None" separatorColor="transparent" height="100%">
<lv:RadListView.itemTemplate>
<GridLayout columns="*, 17" rows="50" class="{{ IsLast ? 'entity-item-last' : 'entity-item' }}">
<StackLayout col="0" verticalAlignment="center" marginLeft="5">
<Label text="{{ FullName ? FullName : '' }}" textWrap="true" fontSize="14" color="#4B4F63"/>
<Label text="{{ OrganisationName ? OrganisationName : '' }}" visibility="{{ OrganisationName ? 'visible' : 'collapsed' }}" textWrap="true" fontSize="12" color="#706e77"/>
</StackLayout>
<Image col="1" src="res://arrow_r" width="6" verticalAlignment="center"></Image>
</GridLayout>
</lv:RadListView.itemTemplate>
</lv:RadListView>
<StackLayout visibility="{{ Employees ? 'collapsed' : 'visible' }}">
<Label text="No record found" fontSize="14" padding="5" margin="0 5" color="#aeafb7" />
</StackLayout>
</StackLayout>
</StackLayout>
实施
<GridLayout rows="auto, auto, *, auto">
<ScrollView row="3" visibility="{{ selectedTabIndex == 2 ? 'visible' : 'collapsed' }}">
<GridLayout rows="auto, auto, auto, auto, auto, auto, *" columns="*, *" class="tab-container" paddingBottom="15">
....
<SearchComponent:EmployeePanel row="3" colSpan="2" marginTop="15" />
</GridLayout>
</ScrollView>
</GridLayout>
....
问题是,StackLayout
没有预定义的大小,将占用子组件所需的空间。在这种情况下,RadListView
也缺少预定义的大小(height=“100%”
,但父堆栈布局是无限大的)。在iOS上,列表视图后面的本机控件需要测量和占用一个大小
因此,作为一种可能的解决方案,尝试提供一个大小(用于容器或直接到RadListView
),或使用GridLayout和rows=“*”
占用所有可用空间,然后将row=“0”
设置到RadListView
例如,类似这样的事情:
<GridLayout rows="auto, 500" xmlns:lv="nativescript-ui-listview">
<GridLayout row="0" rows="*" columns="auto, *, auto" verticalAlignment="top" onTap="EntityHeaderTap" class="entity-header">
<Image row="0" col="0" width="23" src="res://detail_Employee" verticalAlignment="center"/>
<StackLayout row="0" col="1" orientation="horizontal" verticalAlignment="center" marginLeft="10">
<Label id="entityLabel" text="Employee" fontSize="15" verticalAlignment="center" color="#706e77"/>
</StackLayout>
<Image id="entityArrow" row="0" col="2" width="14" src="res://arrow_u" verticalAlignment="center" />
</GridLayout>
<lv:RadListView row="1" id="employeeListView" items="{{ Employees }}" itemTap="EmployeeItemTap" visibility="{{ Employees ? 'visible' : 'collapsed' }}" selectionBehavior="None" separatorColor="transparent" height="100%">
<lv:RadListView.itemTemplate>
<GridLayout columns="*, 17" rows="50" class="{{ IsLast ? 'entity-item-last' : 'entity-item' }}">
<StackLayout col="0" verticalAlignment="center" marginLeft="5">
<Label text="{{ FullName ? FullName : '' }}" textWrap="true" fontSize="14" color="#4B4F63"/>
<Label text="{{ OrganisationName ? OrganisationName : '' }}" visibility="{{ OrganisationName ? 'visible' : 'collapsed' }}" textWrap="true" fontSize="12" color="#706e77"/>
</StackLayout>
<Image col="1" src="res://arrow_r" width="6" verticalAlignment="center"></Image>
</GridLayout>
</lv:RadListView.itemTemplate>
</lv:RadListView>
</GridLayout >
谢谢你的帮助!这里的解决方案在ScrollView上下文中不起作用。在实现部分,我提到了这个组件的用法。我必须在一个页面上多次放置此组件以显示各种其他数据。在上下文中使用ScrollView,有没有办法在iOS上获得某种自动高度?德克萨斯州!到2020年,这个答案非常有用。
rows="auto, *"