mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
@ -278,6 +278,8 @@
|
||||
<DependentUpon>action-view.xml</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="apps\ui-tests-app\pages\touch-event.ts" />
|
||||
<Content Include="apps\ui-tests-app\padding\padding.css" />
|
||||
<Content Include="apps\ui-tests-app\padding\padding.xml" />
|
||||
<Content Include="apps\ui-tests-app\pages\touch-event.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
@ -2220,7 +2222,7 @@
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
<UserProperties ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" />
|
||||
<UserProperties ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
@ -80,6 +80,8 @@ examples.set("pwrap", "layouts-percent/wrap");
|
||||
examples.set("modalview", "modal-view/modal-view");
|
||||
examples.set("nordic", "nordic/nordic");
|
||||
|
||||
examples.set("padding", "padding/padding");
|
||||
|
||||
examples.set("gestures", "pages/gestures");
|
||||
examples.set("touch", "pages/touch-event");
|
||||
examples.set("handlers", "pages/handlers");
|
||||
|
3
apps/ui-tests-app/padding/padding.css
Normal file
3
apps/ui-tests-app/padding/padding.css
Normal file
@ -0,0 +1,3 @@
|
||||
TextField, TextView, Button, Label {
|
||||
padding: 50;
|
||||
}
|
8
apps/ui-tests-app/padding/padding.xml
Normal file
8
apps/ui-tests-app/padding/padding.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" >
|
||||
<StackLayout>
|
||||
<Label id="label" text="Label" backgroundColor="red"/>
|
||||
<TextField id="textField" text="TextField" backgroundColor="green"/>
|
||||
<TextView id="textView" text="TextView" backgroundColor="blue"/>
|
||||
<Button id="button" text="Button" backgroundColor="yellow"/>
|
||||
</StackLayout>
|
||||
</Page>
|
@ -165,11 +165,28 @@ export class TextViewStyler implements style.Styler {
|
||||
}
|
||||
}
|
||||
|
||||
// Padding
|
||||
private static setPaddingProperty(view: View, newValue: any) {
|
||||
var top = newValue.top + view.borderWidth;
|
||||
var left = newValue.left + view.borderWidth;
|
||||
var bottom = newValue.bottom + view.borderWidth;
|
||||
var right = newValue.right + view.borderWidth;
|
||||
(<UITextView>view._nativeView).textContainerInset = UIEdgeInsetsFromString(`{${top},${left},${bottom},${right}}`);
|
||||
}
|
||||
|
||||
private static resetPaddingProperty(view: View, nativeValue: any) {
|
||||
(<UITextView>view._nativeView).textContainerInset = UIEdgeInsetsFromString("{0,0,0,0}");
|
||||
}
|
||||
|
||||
public static registerHandlers() {
|
||||
style.registerHandler(style.colorProperty, new style.StylePropertyChangedHandler(
|
||||
TextViewStyler.setColorProperty,
|
||||
TextViewStyler.resetColorProperty,
|
||||
TextViewStyler.getNativeColorValue), "TextView");
|
||||
|
||||
style.registerHandler(style.nativePaddingsProperty, new style.StylePropertyChangedHandler(
|
||||
TextViewStyler.setPaddingProperty,
|
||||
TextViewStyler.resetPaddingProperty), "TextView");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user