mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Added Padding+Border support for Label, Button, TextField and TextView for both platforms. Only iOS TextView does not support them.
This commit is contained in:
12
apps/editable-text-demo/main-page.css
Normal file
12
apps/editable-text-demo/main-page.css
Normal file
@@ -0,0 +1,12 @@
|
||||
Button, Label, TextView, TextField {
|
||||
border-color: black;
|
||||
border-width: 50;
|
||||
border-radius: 3;
|
||||
padding-left: 50;
|
||||
padding-top: 50;
|
||||
padding-right: 50;
|
||||
padding-bottom: 50;
|
||||
margin: 10;
|
||||
font-size: 24;
|
||||
text-align: right;
|
||||
}
|
||||
@@ -18,34 +18,34 @@ var label: labelModule.Label;
|
||||
export function onPageLoaded(args: observableModule.EventData) {
|
||||
var page = <pagesModule.Page>args.object;
|
||||
|
||||
stackLayout = page.getViewById<stackLayoutModule.StackLayout>("stack");
|
||||
button = page.getViewById<buttonModule.Button>("button");
|
||||
label = page.getViewById<labelModule.Label>("label");
|
||||
//stackLayout = page.getViewById<stackLayoutModule.StackLayout>("stack");
|
||||
//button = page.getViewById<buttonModule.Button>("button");
|
||||
//label = page.getViewById<labelModule.Label>("label");
|
||||
|
||||
if (stackLayout.android) {
|
||||
stackLayout.android.setClickable(true);
|
||||
stackLayout.android.setFocusableInTouchMode(true);
|
||||
}
|
||||
//if (stackLayout.android) {
|
||||
// stackLayout.android.setClickable(true);
|
||||
// stackLayout.android.setFocusableInTouchMode(true);
|
||||
//}
|
||||
|
||||
textField = page.getViewById<textFieldModule.TextField>("textField");
|
||||
textField.style.backgroundColor = new colorModule.Color("LightGray");
|
||||
//textField = page.getViewById<textFieldModule.TextField>("textField");
|
||||
//textField.style.backgroundColor = new colorModule.Color("LightGray");
|
||||
|
||||
textView = page.getViewById<textViewModule.TextView>("textView");
|
||||
textView.style.backgroundColor = new colorModule.Color("BlanchedAlmond");
|
||||
//textView = page.getViewById<textViewModule.TextView>("textView");
|
||||
//textView.style.backgroundColor = new colorModule.Color("BlanchedAlmond");
|
||||
|
||||
var viewModel = new model.WebViewModel();
|
||||
page.bindingContext = viewModel;
|
||||
//var viewModel = new model.WebViewModel();
|
||||
//page.bindingContext = viewModel;
|
||||
}
|
||||
|
||||
export function onTap(args: observableModule.EventData) {
|
||||
if (textField.updateTextTrigger === enums.UpdateTextTrigger.focusLost) {
|
||||
textField.updateTextTrigger = enums.UpdateTextTrigger.textChanged;
|
||||
textView.updateTextTrigger = enums.UpdateTextTrigger.textChanged;
|
||||
button.text = "textChanged";
|
||||
}
|
||||
else {
|
||||
textField.updateTextTrigger = enums.UpdateTextTrigger.focusLost;
|
||||
textView.updateTextTrigger = enums.UpdateTextTrigger.focusLost;
|
||||
button.text = "focusLost";
|
||||
}
|
||||
//if (textField.updateTextTrigger === enums.UpdateTextTrigger.focusLost) {
|
||||
// textField.updateTextTrigger = enums.UpdateTextTrigger.textChanged;
|
||||
// textView.updateTextTrigger = enums.UpdateTextTrigger.textChanged;
|
||||
// button.text = "textChanged";
|
||||
//}
|
||||
//else {
|
||||
// textField.updateTextTrigger = enums.UpdateTextTrigger.focusLost;
|
||||
// textView.updateTextTrigger = enums.UpdateTextTrigger.focusLost;
|
||||
// button.text = "focusLost";
|
||||
//}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<Page loaded="onPageLoaded">
|
||||
<StackLayout id="stack">
|
||||
<Button id="button" text="textChanged" height="100" margin="20" tap="onTap" backgroundColor="Red"/>
|
||||
<Label id="label" text="{{ text }}" height="100" margin="20"/>
|
||||
<TextField id="textField" text="{{ text }}" margin="20" autocapitalizationType="none" autocorrect="false"/>
|
||||
<TextView id="textView" text="{{ text }}" height="100" margin="20" autocapitalizationType="none" autocorrect="false"/>
|
||||
<Button id="button" text="button" tap="onTap" backgroundColor="Green" />
|
||||
<Label id="label" text="label" backgroundColor="Yellow"/>
|
||||
<TextField id="textField" text="text-field" hint="hint" backgroundColor="Red"/>
|
||||
<TextView id="textView" text="text-view" backgroundColor="Blue"/>
|
||||
</StackLayout>
|
||||
</Page>
|
||||
Reference in New Issue
Block a user