mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Placeholder: A widget that allows adding native views to the visual tree.
This commit is contained in:
3
apps/placeholder-demo/app.ts
Normal file
3
apps/placeholder-demo/app.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import application = require("application");
|
||||
application.mainModule = "main-page";
|
||||
application.start();
|
||||
7
apps/placeholder-demo/main-page.android.ts
Normal file
7
apps/placeholder-demo/main-page.android.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import placeholder = require("ui/placeholder");
|
||||
|
||||
export function creatingView(args: placeholder.CreateViewEventData) {
|
||||
var nativeView = new android.widget.LabelView(args.context);
|
||||
nativeView.setText("Native");
|
||||
args.view = nativeView;
|
||||
}
|
||||
7
apps/placeholder-demo/main-page.ios.ts
Normal file
7
apps/placeholder-demo/main-page.ios.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import placeholder = require("ui/placeholder");
|
||||
|
||||
export function creatingView(args: placeholder.CreateViewEventData) {
|
||||
var nativeView = new UILabel();
|
||||
nativeView.text = "Native";
|
||||
args.view = nativeView;
|
||||
}
|
||||
5
apps/placeholder-demo/main-page.xml
Normal file
5
apps/placeholder-demo/main-page.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<Page xmlns="http://www.nativescript.org/tns.xsd">
|
||||
<StackLayout>
|
||||
<Placeholder creatingView="creatingView"/>
|
||||
</StackLayout>
|
||||
</Page>
|
||||
2
apps/placeholder-demo/package.json
Normal file
2
apps/placeholder-demo/package.json
Normal file
@@ -0,0 +1,2 @@
|
||||
{ "name" : "template-hello-world",
|
||||
"main" : "app.js" }
|
||||
Reference in New Issue
Block a user