[英]How to give textinput skin to the textinput control in flex 4.5 mobile
我創建了一個從TextInputSkin擴展的RoundedTextInputSkin類
package skins
{
import assets.TextInput_389X35;
import spark.skins.mobile.TextInputSkin;
public class RoundedTextInputSkin extends TextInputSkin
{
public function RoundedTextInputSkin()
{
super();
borderClass = TextInput_389X35;
layoutBorderSize = 5;
}
}
}
現在,我將此皮膚作為skinClass提供給textInput控件。 我可以看到roundedTextInput,但是在textinput中輸入的文本不可見。 誰能告訴我我的代碼出了什么問題。
這是我的fxg文件
<?xml version="1.0" encoding="utf-8" ?>
<Graphic version="2.0" ai:appVersion="16.0.0.682" ATE:version="1.0.0" flm:version="1.0.0" d:using="" xmlns="http://ns.adobe.com/fxg/2008" xmlns:ATE="http://ns.adobe.com/ate/2009" xmlns:ai="http://ns.adobe.com/ai/2009" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:flm="http://ns.adobe.com/flame/2008">
<Group x="3" y="1.35449" ai:seqID="1" flm:knockout="false">
<Rect x="0.5" y="0.5" width="389" height="35" radiusX="16.9997" radiusY="16.9997" ai:seqID="2">
<fill>
<LinearGradient x="194.5" y="0.38916" scaleX="34.2022" rotation="90">
<GradientEntry ratio="0" color="#B0B0B0"/>
<GradientEntry ratio="1" color="#E0E0E0"/>
</LinearGradient>
</fill>
</Rect>
<Rect x="0.5" y="0.5" width="389" height="35" radiusX="16.9997" radiusY="16.9997" ai:seqID="3"/>
</Group>
</Graphic>
目前尚不清楚您的FXG文件與您顯示的皮膚類別之間的關系。 但是,我將假設您提供的FXG是代碼中引用的TextInput_389X35。 我假設您的自定義邊框位於所有其他元素之上; 使它們不可見。 根據TextSkinBase的createChildren()方法; border元素放置在其他所有元素之上:
override protected function createChildren():void
{
super.createChildren();
if (!textDisplay)
{
textDisplay = StyleableTextField(createInFontContext(StyleableTextField));
textDisplay.styleName = this;
textDisplay.editable = true;
textDisplay.useTightTextBounds = false;
addChild(textDisplay);
}
if (!border)
{
border = new borderClass();
addChild(border);
}
}
默認的Border FXG元素使用路徑創建邊框,以便“填充”為邊框。 通過使用“矩形”,您將在其他所有物體上放置一個大正方形。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.