想要 Nativescript XML 中没有底部边框的 textView 和 textField
Want a textView or textField in Native Script XML without bottom border
默认文本框有底边框。
如何在 Native Script XML 中获得没有底部边框的 textView 或 textField?
一个可能的决定是删除文本字段,文本视图边框底部是设置背景颜色。这也会使边框变色。下面我给大家举个例子
主-page.xml
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
<StackLayout backgroundColor="red">
<Label text="Tap the button" class="title"/>
<Button text="TAP" tap="{{ onTap }}" />
<Label text="{{ message }}" class="message" textWrap="true"/>
<TextField hint="" id="tfield" text="tests textfield"/>
<TextView hint="" id="tview" text="tests textView" editable="true" style="border-color:white; " />
</StackLayout>
</Page>
主-page.js
var main_view_model_1 = require("./main-view-model");
var color_1 = require('color');
// Event handler for Page "navigatingTo" event attached in main-page.xml
function navigatingTo(args) {
// Get the event sender
var page = args.object;
var tf = page.getViewById("tfield");
tf.borderColor = new color_1.Color("#ffffff");
tf.backgroundColor = new color_1.Color(100, 255, 0, 0);
var tv = page.getViewById("tview");
tv.borderColor = new color_1.Color("#ffffff");
tv.backgroundColor = new color_1.Color(100, 255, 0, 0);
page.bindingContext = new main_view_model_1.HelloWorldModel();
}
exports.navigatingTo = navigatingTo;
根据 Nikolay 的建议,样式表中应执行以下操作
background-color: transparent;
border-color: transparent;
默认文本框有底边框。 如何在 Native Script XML 中获得没有底部边框的 textView 或 textField?
一个可能的决定是删除文本字段,文本视图边框底部是设置背景颜色。这也会使边框变色。下面我给大家举个例子
主-page.xml
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
<StackLayout backgroundColor="red">
<Label text="Tap the button" class="title"/>
<Button text="TAP" tap="{{ onTap }}" />
<Label text="{{ message }}" class="message" textWrap="true"/>
<TextField hint="" id="tfield" text="tests textfield"/>
<TextView hint="" id="tview" text="tests textView" editable="true" style="border-color:white; " />
</StackLayout>
</Page>
主-page.js
var main_view_model_1 = require("./main-view-model");
var color_1 = require('color');
// Event handler for Page "navigatingTo" event attached in main-page.xml
function navigatingTo(args) {
// Get the event sender
var page = args.object;
var tf = page.getViewById("tfield");
tf.borderColor = new color_1.Color("#ffffff");
tf.backgroundColor = new color_1.Color(100, 255, 0, 0);
var tv = page.getViewById("tview");
tv.borderColor = new color_1.Color("#ffffff");
tv.backgroundColor = new color_1.Color(100, 255, 0, 0);
page.bindingContext = new main_view_model_1.HelloWorldModel();
}
exports.navigatingTo = navigatingTo;
根据 Nikolay 的建议,样式表中应执行以下操作
background-color: transparent;
border-color: transparent;