我对 NativeScript 很陌生,但希望能够防止我创建的自定义模式在用户点击背景时被关闭,特别是对于 Android 设备。
当使用 NativeScript 提供的对话框时,我可以很容易地完成这一点,即对于一个动作对话框,可以通过cancelable在提供的选项中设置为 false来简单地做到这一点。
let options: ActionOptions = {
title: "Sticky Dialog",
message: "Will not disappear if background tapped",
cancelable: false,
actions: ["Cancel", "OK"]
};
dialogs.action(options).then(result => {
console.log(result);
});
Run Code Online (Sandbox Code Playgroud)
但是当使用选项显示我的自定义模式时,ModalDialogService没有可以在选项中设置的属性,目前我有
let modalOptions: ModalDialogOptions = {
context: {},
fullscreen: false,
viewContainerRef: this.vcRef,
};
this.modalService.showModal(DeviceRegistrationComponent, modalOptions)
.then(result => {
if (result != null) {
this.handleDeviceOtpEntry(result.otp);
}
});
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?我不介意必须设置特定的原生 android 属性,但似乎无法获得显示的实际模式的句柄。
我创建了许多 Ionic 应用程序,使用它的所有版本,从 1.x 到最新的 3.x
一直以来,cordova 和 AngularJS 都是一个很棒的框架,拥有庞大的社区,随着时间的推移,它变得越来越好。但它仍然是在 WebView 上工作的混合体..
以我对 AngularJS 的了解,我应该轻松地转向 NativeScript,还是从 ReactNative 重新开始?从我所见,ReactNative 拥有更好的社区,而且很多大型应用程序都在它的展示中。
那么,对于跨平台应用程序,我应该继续使用 Ionic,使用 NativeScript,还是转向 ReactNative?
cross-platform angularjs ionic-framework nativescript react-native
我有一个已部署到 PlayStore 的应用程序。通过新的更新,我希望这个应用程序显示一个与当前略有不同的图标和启动屏幕。
我的styles.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- theme to use FOR launch screen-->
<style name="LaunchScreenThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
<item name="colorPrimary">@color/ns_primary</item>
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
<item name="colorAccent">@color/ns_accent</item>
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowFullscreen">true</item>
</style>
<style name="LaunchScreenTheme" parent="LaunchScreenThemeBase">
</style>
<!-- theme to use AFTER launch screen is loaded-->
<style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
<item name="colorPrimary">@color/ns_primary</item>
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
<item name="colorAccent">@color/ns_accent</item>
<item name="android:windowFullscreen">false</item>
</style>
<style name="AppTheme" parent="AppThemeBase">
</style>
<!-- theme for actioon-bar -->
<style name="NativeScriptToolbarStyleBase" parent="Widget.AppCompat.Toolbar">
<item …Run Code Online (Sandbox Code Playgroud) 在 NativeScript 中,如何使用 JavaScript(不是 TypeScript/Angular)获取文本字段的值?
XML:
我尝试了“getViewByID()”的各种组合,但没有任何效果(也许我没有“需要”正确的库?)。不打算进行 2 向绑定;只需获取值(打印到控制台)。
Nativescript radListView 不显示来自 ios 和 android 操作系统的组件的绑定项。
操作栏和通常的 ListView 显示数据,但 radlistview 不显示。控制台没有显示错误。但我看到下一个存储库中的 RadListView 可以工作 -> https://github.com/telerik/nativescript-ui-samples-angular
我的开发环境如下。
os: macOS sierra 10.12.6
node : v6.12.0
npm : 3.10.10
nativescript 之后可以看到其他的,在 package.json
我似乎这个问题是关于这些......
但我无法提炼。
我在 'tns create ui-test --ng' 之后在 angular 上实现了 RadListView,如下所示。
成分
export class ItemsComponent implements OnInit {
private _dataItems: ObservableArray<Item>;
constructor() {
}
get dataItems(): ObservableArray<Item> {
return this._dataItems;
}
ngOnInit() {
this._dataItems = new ObservableArray([
{ id: 1, name: "Ter Stegen", role: …Run Code Online (Sandbox Code Playgroud) 我使用空白模板和 vanilla javascript 开发了一个简单的 nativescript 应用程序。当我构建应用程序时,大小约为 12 MB。我在 android studio 中做了同样的应用程序,apk 大约 2.5 MB,这意味着小 5 倍。我使用的是最新版本的 nativescript,我使用了 CLI 命令。
tns build android --release --key-store-path petscrapbook.keystore --key-store-password petscrapbook --key-store-alias petscrapbook --key-store-alias-password petscrapbook
Run Code Online (Sandbox Code Playgroud)
你有同样的问题吗?
我熟悉 Angular,但我才刚刚开始学习 NativeScript。我有一个使用 NativeScript 库中的 Tab 模板的 Tab 界面。我想在我的选项卡被选中时运行一个函数,但我无法弄清楚。
这是 app.component.html:
<TabView [(ngModel)]="tabSelectedIndex" androidTabsPosition="bottom" (selectedIndexChanged)="onSelectedIndexChanged($event)">
<page-router-outlet *tabItem="{title: 'Home', iconSource: getIconSource('home')}" name="homeTab">
</page-router-outlet>
<page-router-outlet *tabItem="{title: 'Away', iconSource: getIconSource('browse')}" name="awayTab">
</page-router-outlet>
<page-router-outlet *tabItem="{title: 'Matchup', iconSource: getIconSource('search')}" name="matchupTab">
</page-router-outlet>
</TabView>
Run Code Online (Sandbox Code Playgroud)
我还没有真正在 matchup.component.ts 中有任何东西,因为我还没有弄清楚这一点。不过这里是:
import { Component, OnInit } from "@angular/core";
import { DataService } from "../core/data.service";
import { ActivatedRoute } from "@angular/router";
@Component({
selector: "Matchup",
moduleId: module.id,
templateUrl: "./matchup.component.html"
})
export class MatchupComponent implements OnInit {
constructor(
private data: DataService,
private route: ActivatedRoute …Run Code Online (Sandbox Code Playgroud) 尝试通过 Angular/Nativescript 中的 https 发送发布请求。我曾尝试向我们的 api 以及公共 api 发布请求,但它们都失败了。事实上,它们不会失败,因为它们没有显示任何错误,它们只是根本没有被执行。
这些发布请求在 Angular Web 应用程序中工作,并且它们使用 Postman 工作。似乎是 Nativescript 或 Android 权限问题的问题。
我正在尝试显示一个本地 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
我正在尝试在我在 NativeScript 上开发的应用程序上使用一些字体很棒的图标,我只是不知道如何使用它们。
我尝试了一些方法,比如将我想要使用的图标的 unicode 放在 HTML 中的提示上,例如 (Ex:hint="#f2c0 username")。我曾尝试使用字体系列:“FontAwesome,'fontawesome-webfont';” 在 CSS 中。
我试图在 TextField 的提示上放置一个用户图标。
nativescript ×10
android ×4
angular ×4
angularjs ×3
font-awesome ×1
http ×1
radlistview ×1
react-native ×1