我正在尝试包装一些元素以提供样式,但是我看不到任何可用作容器的元素。
在这种情况下应该使用什么?
还请链接到Nativescript中的可用CSS属性,因为我无法找到可用CSS属性的列表。
我一直在与nativescript一起玩,我看到它为我们提供了使用CSS设置样式的元素。
但是,在文档http://docs.nativescript.org/ui/styling.html中,我没有看到有关CSS的度量单位的任何提及。
这有效
.title {
font-size: 30;
horizontal-align: center;
margin: 20;
}
Run Code Online (Sandbox Code Playgroud)
这不起作用
.title {
font-size: 30;
horizontal-align: center;
margin: 20px;
}
Run Code Online (Sandbox Code Playgroud)
请注意,在第二个示例中,边距为20px。
所以我的问题是,当涉及CSS时,nativescript使用哪个单元?
每次运行ios仿真器时,我都会收到以下警告/错误.目前该应用程序非常简单,只是一个教程应用程序.这是我在控制台中看到的:
** BUILD SUCCEEDED **
Project successfully built.
Using /Users/wittner/Projects/nativescript/sample-Groceries/platforms/ios/build/emulator/sampleGroceries.app
Starting iOS Simulator
Apr 26 20:35:11 MacBook-Pro backboardd[5804]: SecTaskCopyDebugDescription: sampleGroceries[6014]
Apr 26 20:35:11 MacBook-Pro backboardd[5804]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Apr 26 20:35:11 MacBook-Pro backboardd[5804]: SecTaskCopyDebugDescription: sampleGroceries[6014]
Apr 26 20:35:11 MacBook-Pro backboardd[5804]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Apr 26 20:35:11 MacBook-Pro backboardd[5804]: SecTaskCopyDebugDescription: sampleGroceries[6014]
Apr 26 20:35:11 MacBook-Pro backboardd[5804]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Apr 26 20:35:11 MacBook-Pro backboardd[5804]: SecTaskCopyDebugDescription: sampleGroceries[6014]
Apr 26 20:35:11 MacBook-Pro backboardd[5804]: SecTaskLoadEntitlements failed error=22 cs_flags=200, …Run Code Online (Sandbox Code Playgroud) 我有一个带有angular2应用程序的nativescript for android,我想利用nativescript-sqlite的离线存储功能.问题是我得到以下异常:
Failed to find module: "nativescript-sqlite", relative to: /app/tns_modules/
Run Code Online (Sandbox Code Playgroud)
在下面的行:
var Sqlite = require("nativescript-sqlite");
Run Code Online (Sandbox Code Playgroud)
我使用以下命令安装插件
tns插件添加nativescript-sqlite
我创建了一个带有角度服务的db.service.ts文件,其内容如下:
import {Injectable} from "@angular/core";
import {Config} from "../config";
import {Observable} from "rxjs/Rx";
import "rxjs/add/operator/do";
import "rxjs/add/operator/map";
import {Profile} from "../profile/profile";
var Sqlite = require("nativescript-sqlite");
@Injectable()
export class DbService {
database: any;
constructor() {
(new Sqlite("gtel.db")).then(db => {
this.database = db;
db.resultType(Sqlite.RESULTSASOBJECT);
this.database.execSQL("CREATE TABLE IF NOT EXISTS profile (id INTEGER PRIMARY KEY AUTOINCREMENT," +
" username TEXT, idnumber TEXT, firstname TEXT, lastname …Run Code Online (Sandbox Code Playgroud) 我正在关注NativeScript教程,但是当我尝试使用res://加载图像时,我无法使用iOS.
<Image src="res://logo" stretch ="none" />
Run Code Online (Sandbox Code Playgroud)
该文件位于App_Resources/iOS/logo.png中
更新:
现在有效:
1.-从设备/模拟器中卸载应用程序
2.-然后做一个新的tns build ios以获得新的构建
默认情况下,iOS上的标签内部文本是垂直对齐的,但在Android上却没有.如何在Android上垂直居中(我感兴趣的是将文本置于Label内部,而不是将标签包装在任何其他布局中以获得相同的效果)?
看看我的意思在iOS和Android上运行下一个代码.
XML:
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="onLoaded">
<Label text="test" />
</Page>
Run Code Online (Sandbox Code Playgroud)
CSS:
Label {
width: 60;
height: 60;
text-align: center;
background-color: aquamarine;
border-radius: 30;
}
Run Code Online (Sandbox Code Playgroud) 当我运行tns run android或tns doctor收到错误消息时,未设置ANDROID_HOME环境变量。但是它已经明确设置了。Mac OSX Sierra 10.12.3。
bash-3.2$ tns run android
The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
bash-3.2$ $ANDROID_HOME
bash: /Users/rlangton/Library/Android/sdk: is a directory
bash-3.2$
Run Code Online (Sandbox Code Playgroud) 我刚开始学习并使用nativescript; 一切似乎都没问题,我正在取得进展,但我无法找到持续交付的解决方案.(在推送bitbucket中的master分支时,我想自动进行构建并分发它).我尝试过来自Microsoft的appcenter(之前我用过Xamarin)但是无法使它工作.
运行命令tns run android或时出现以下错误tns debug android。直到我.gradle/gradle.properties从中删除文件夹之前,它都无法正常工作C:\Users\yash\.gradle\gradle.properties,现在我无法撤消它。
我收到的50个错误中有1个是:
Run Code Online (Sandbox Code Playgroud)Could not resolve all artifacts for configuration ':classpath'. Could not resolve org.ow2.asm:asm:6.0. Required by: project : > com.android.tools.build:gradle:3.3.1 project : > com.android.tools.build:gradle:3.3.1 > com.android.tools.build:builder:3.3.1 project : > com.android.tools.build:gradle:3.3.1 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02
NS版本
"nativescript": {
"id": "org.nativescript.chennaivolunteers",
"tns-ios": {
"version": "5.0.0"
},
"tns-android": {
"version": "5.2.1"
}
}
Run Code Online (Sandbox Code Playgroud)
app.gradle
...
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
} …Run Code Online (Sandbox Code Playgroud) 我尝试找出创建模块的方式,该模块能够以模态打开并带有在内部导航的选项。在TabView出口中或从其他模式中打开。就像这张照片上展示的那样:
我找到了许多简单的示例,但是如果我将其与模块结合使用-我会像这样的错误不断摇摆
我已经准备好了游乐场 https://play.nativescript.org/?template=play-ng&id=7Pfmcl&v=4
我的灵感:
https://www.nativescript.org/blog/implementing-a-login-for-nativescript-apps-with-tab-based-navigation-它已经解决了登录,欢迎和tabview
https://medium.com/@williamjuan027/nativescript-angular-lazy-loading-modals-e56451392c8d-延迟加载模式
有人可以帮我吗?您是否有在原生脚本中使用angular进行一些高级路由的经验?
非常感谢Michal