我必须开发适用于iOS和Android的应用程序,它必须能够在现有应用程序中运行嵌入式应用程序.我通常会使用Cordova进行此操作,因为它可以处理多个平台,并且可以通过创建Cordova WebView轻松嵌入现有应用程序中.
由于这个应用程序正在大量使用动画,我一直在玩NativeScript,以避免在WebView上运行这种UI的糟糕性能.
问题是,在本机应用程序中嵌入NativeScript应用程序似乎并不简单.我找到了这个https://groups.google.com/forum/m/#!msg/nativescript/4kDFcX6gtxA/vdjruLLVBQAJ这仍然是真的吗?有关如何实现这一目标的任何建议或想法?
我很想知道如何在我当前的NativeScript + Angular 2项目上添加侧边菜单,我知道它有一个侧面菜单模板,但我把它作为空白项目开始,我很想知道如何添加这个功能.
我有这样的ListView
<ListView [items]="groceryList" row="1" class="small-spacing" [class.visible]="listLoaded">
<template let-item="item" columns="*, auto" >
<Label [text]="item.name" class="medium-spacing"></Label>
</template>
</ListView>
Run Code Online (Sandbox Code Playgroud)
我想添加图片按钮.于是我就加入columns="*, auto"到template和
col="0"对标签和col="1"我Image
<ListView [items]="groceryList" row="1" class="small-spacing" [class.visible]="listLoaded">
<template let-item="item" columns="*, auto" >
<Label [text]="item.name" class="medium-spacing" col="0"></Label>
<Image src="res://delete" (tap)="delete(item.id)" col="1"></Image>
</template>
</ListView>
Run Code Online (Sandbox Code Playgroud)
运行模拟器后,我收到一个错误:
任何想法为什么会发生这种情况以及如何解决这个问题?
我将Android SDK放在/ opt/android-sdk中,并使用以下行更新了.bashrc文件:
export ANDROID_HOME ="/ opt/android-sdk"export PATH = $ ANDROID_HOME/tools:$ ANDROID_HOME/platform-tools:$ PATH
然后我重新加载.bashrc文件:
source ~/.bashrc
之后,我通过命令命令检查ANDROID_HOME:
echo $ANDROID_HOME
结果如下:
/opt/android-sdk
这是我放置它的正确位置.之后我创建了一个NativeScript Mobile Application项目:
tns create MobileApp --ng
然后我进入MobileApp目录并试图将平台添加为Android:
tns platform add android
但我得到了这个错误,如下所示:
该ANDROID_HOME环境变量未设置,或者它指向一个不存在的目录.您将无法为Android执行任何与构建相关的操作.
在NativeScript Mobile Application项目中添加Android作为平台的上述过程中,我是否遗漏了什么?
我已经安装了NativeScript,tns platform add android但我尝试这样做,但它不起作用.ANDROID_HOME路径是正确的,我已经安装了SDK(API 22和最新版本)和工具(25.0.2).我跑的tns doctor时候说:
WARNING: The Android SDK is not installed or is not configured properly.
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=25.0.2'.
You need to have Android SDK 22 or later and the latest Android Support Repository …Run Code Online (Sandbox Code Playgroud) macos android android-sdk-tools nativescript angular2-nativescript
即时通讯制作移动应用.在我的登录表单中,我有2个TextFields
<TextField hint="Email Address" keyboardType="email" [(ngModel)]="email" autocorrect="false" autocapitalizationType="none"></TextField>
<TextField hint="Password" secure="true" [(ngModel)]="password"></TextField>
<Label [text]="email"></Label>Run Code Online (Sandbox Code Playgroud)
在component.ts中
import { Component, OnInit } from '@angular/core';
import { Router } from "@angular/router";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { Page } from "ui/page";
import * as Toast from 'nativescript-toast';
@Component({
moduleId: module.id,
selector: 'sign-in',
templateUrl: "template.html"
})
export class SignInPage implements OnInit {
email: string ="example";
password: string;
constructor(private router: Router, page: Page) {
page.actionBarHidden = true;
}
ngOnInit() {
var loginParams = …Run Code Online (Sandbox Code Playgroud)typescript nativescript angular2-forms angular2-nativescript angular
我有一个图像要显示在我的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)
我试图HttpClient在我的Nativescript应用程序中使用Angular ,但是当我在我的组件中导入它时,我得到了Error: Trying to link invalid 'this' to a Java object
更新
我也尝试在Groceries示例中添加它而不更改任何其他内容,但它不起作用
{
"description": "ArkCash",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "arkcash.chbtechnologies.ch.arkcash_mobile",
"tns-android": {
"version": "3.2.0"
}
},
"dependencies": {
"@angular/animations": "~4.4.6",
"@angular/common": "~4.4.6",
"@angular/compiler": "~4.4.6",
"@angular/core": "~4.4.6",
"@angular/forms": "~4.4.6",
"@angular/http": "~4.4.6",
"@angular/platform-browser": "~4.4.6",
"@angular/platform-browser-dynamic": "~4.4.6",
"@angular/router": "~4.4.6",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^2.0.5",
"@ngrx/router-store": "^4.1.0",
"@ngrx/store": "^2.2.3",
"angular2-jwt": "^0.2.3",
"lodash": "^4.17.4",
"moment": "^2.19.1",
"nativescript-angular": "~4.4.1",
"nativescript-drop-down": "^3.2.0",
"nativescript-fabric": "^1.0.6",
"nativescript-pro-ui": …Run Code Online (Sandbox Code Playgroud) 我在nativescript-angular中的组件html文件中尝试了"hr"标记.但它没有在模拟器中显示水平线.(使用ios模拟器测试)
<StackLayout>
hr>
<Label horizontalAlignment="left" textWrap="true" text="Description" class="description-text"></Label>
</StackLayout>
Run Code Online (Sandbox Code Playgroud) 在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