我有一个图像要显示在我的nativescript(使用Angular2)应用程序中,在此我想使图像的不同部分可点击。例如,一个人体图像,我只想知道用户单击了哪个部分。
有没有办法像html一样创建图像映射???
<CardView height="450" width="350" marginTop="10">
<Image src="res://nerves" height="304" width="114" horizontalAlignment="center" verticalAlignment="center"></Image>
</CardView>
Run Code Online (Sandbox Code Playgroud)
有没有办法获取元素的当前位置?它是 x 和 y。我试过了getLocationOnScreen,getLocationInWindow但结果未定义。
我正在尝试找到一种方法来删除带有Angular 6应用程序的元素上的选项卡按钮,但到目前为止无济于事。基本上,我只想保留Tab的内容及其滑动功能。
显然,您可以使用特定的android和iOS方法,但是我不确定该怎么做。
<TabView [(ngModel)]="tabSelectedIndex" (selectedIndexChanged)="onSelectedIndexChanged($event)" (loaded)="tabViewLoaded($event)">
<ng-container *ngFor="let article of articles" #tabView>
<StackLayout *tabItem="{title: article.id}">
<StackLayout>
<NewsDetails></NewsDetails>
</StackLayout>
</StackLayout>
</ng-container>
</TabView>
Run Code Online (Sandbox Code Playgroud)
在我的.ts文件中,可以找到对元素的引用,如下所示:
@ViewChild("tabView") tabView: ElementRef;
ngAfterViewInit() {
console.dir(this.tabView.nativeElement);
}
Run Code Online (Sandbox Code Playgroud)
但是我不知道从现在开始该怎么做。有任何想法吗?以前与此有关的所有问题均未奏效。
这是一个示例游乐场链接:https : //play.nativescript.org/?template=play-ng&id=iK9ZTM
在iOS中,当我放置marker和mapView位置时,地图不会居中显示,但是如果我将手机移至横向并再次旋转至纵向,则地图中心将显示正常。在Adnroid工作正常。
您可以在以下github问题中获得更多信息:https : //github.com/dapriett/nativescript-google-maps-sdk/issues/322
nativescript angular2-nativescript nativescript-telerik-ui nativescript-angular nativescript-plugin
我有一个 NativeScript(angular)应用程序,它当前对服务器进行 API 调用以获取数据。
我想实现一些东西,一旦设备上线但使用我当前的 API 进行双向同步。没有 BaaS。
我想到的第一个解决方案是进行某种缓存。偶尔,应用程序会使数据库中的信息无效并再次获取它。我不喜欢这种方法,因为有很大的列表(可能会改变。它们是分批获取的,即按页。其中之一是下载并存储在设备上的文件列表。所以我必须保留这些仍然在列表中的,并删除那些不在列表中的。这听起来像一场噩梦。
你会如何解决这样的问题?
从版本5代码升级到Nativescript 6的最新版本后,开始在utils中给出ios的getter错误。属性“ getter”在类型“ ios类型”上不存在。在Nativescript 6中有角度。此代码负责在IOS上关闭键盘。
可通过官方文档而非方法进行检查 https://docs.nativescript.org/core-concepts/utils#ios
在不推荐使用Object属性访问运行utils.ios.getter()后也尝试获取错误;使用各自的本机属性,而不是utils.ios ['getter'](UIApplication,UIApplication.sharedApplication)
utils.ios.getter(UIApplication, UIApplication.sharedApplication)
.keyWindow
.endEditing(true);
Run Code Online (Sandbox Code Playgroud)
Getter应该在ios utils中可用
我已经在我的 Nativescript -Angular 代码中实现了 nativescript 图像选择器插件,但我试图弄清楚如何调整从 nativescript-imagepicker 中选取的图像的大小,该图像可以显示为圆圈中的帐户或个人资料图片
有没有办法在已经绘制之后更改/设置GridLayout行的高度?
例如,我有一个像这样的GridLayout设置:
<GridLayout class="template_body" rows="40,*,60">
<StackLayout row="0" [visibility]="isTablet ? 'visible' : 'collapsed'">
<Label text="Drag statements to the proper category."></Label>
<FlexboxLayout flexDirection="row" row="1" [visibility]="isSubmitted ? 'visible' : 'collapsed'">
<AbsoluteLayout height="10" width="10" class="correct-legend"></AbsoluteLayout><Label class="legend-label" text="Correct"></Label>
<AbsoluteLayout height="10" width="10" class="incorrect-legend"></AbsoluteLayout><Label class="legend-label" text="Incorrect"></Label>
</FlexboxLayout>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
我想根据条件更改第一行的高度。到rows =“ 100,*,60”
我尝试通过在gridlayout上使用getRows()获取行,但是似乎无法对返回的内容执行任何操作。看来它正在返回一个Observable而不是api表示应该返回的行数组。
我正在尝试显示一个本地 html 文件,其中包含引用的 JS 和 CSS 以及 PNG 图像。我将这些文件放入适用于 Android 的 NativeScript x Angular 应用程序的资产文件夹中。当我运行 tns run android --bundle 并构建应用程序时 - 资产文件夹不包含 html。文件夹结构从 assets > index.html (和 index.html 引用其他文件)。
是否有某个地方或方式我需要包含 html 文件,以便它们包含在构建中?
android nativescript angular2-nativescript nativescript-telerik-ui nativescript-angular
我在删除每个列表项后的分隔线时遇到问题,并且无法更改分隔线颜色。
我在 Listview 标签和 CSS 中尝试了 separatorColor="transparent" 属性,但它们都不起作用。我也尝试过 SeparatorVisibility="None" 属性,但没有运气。
我已经尝试过GitHub 提供的这个解决方案,但它不起作用。
这是代码:
<GridLayout row="1" class="shop-list-container">
<ListView [items]="rewardsPageData?.shops" class="list-group" height="{{rewardsPageData?.shops?.length * 75}}" separatorColor="transparent">
<ng-template let-shop="item">
<GridLayout class="shop-item list-group-item" columns="2*, 6*, 2*" rows="*, auto" (tap)="goToShopDetails(shop.id)">
<Image src="{{shop.logoImageUrl}}" class="thumb img-circle" col="0" row="0" rowSpan="2" horizontalAlignment="left"></Image>
<Label class="shop-name" [text]="shop.title" row="0" col="1"></Label>
<Label class="shop-type" text="{{shop?.category}}" row="1" col="1"></Label>
<Label text="See location" class="see-location-text" textWrap="true" col="2" row="0" rowSpan="2" horizontalAlignment="right"></Label>
</GridLayout>
</ng-template>
</ListView>
</GridLayout>
Run Code Online (Sandbox Code Playgroud) javascript nativescript angular2-nativescript nativescript-angular angular
我使用以下命令新安装了 Nativescript Angular 项目:
\nng new --collection=@nativescript/schematics my-mobile-app\nRun Code Online (Sandbox Code Playgroud)\n我从nativescript-schematics获得的命令
\n全新安装后,我尝试在 Android 模拟器上运行它。
\ntns run android\nRun Code Online (Sandbox Code Playgroud)\n然后我在编译过程中收到此错误:
\nSearching for devices...\nPreparing project...\nFile change detected. Starting incremental webpack compilation...\n\nwebpack is watching the files\xe2\x80\xa6\n\nHash: c018afa003f9a5a7d1cd\nVersion: webpack 4.44.2\nTime: 4451ms\nBuilt at: 11/05/2020 1:54:33 PM\n 3 assets\nEntrypoint bundle = runtime.js vendor.js bundle.js\n[./app.css] 1.05 KiB {bundle} [built]\n[./main.ts] 1.13 KiB {bundle} [built]\n[~/package.json] external "~/package.json" 42 bytes {bundle} [optional] [built]\n + 331 hidden modules\n\nERROR in error TS5060: Option \'paths\' cannot be used without …Run Code Online (Sandbox Code Playgroud) webpack nativescript angular2-nativescript nativescript-angular angular