0

私はAppceleratorAlloyの新しい開発者です。Plzは、デバイスの表示サイズに応じてテキストフィールドの高さプロパティを設定する方法を教えてくれます。

チタンで。

  var name_Txt = Titanium.UI.createTextField({
        height : (Ti.Platform.displayCaps.platformHeight< 481) ? 32 : Ti.Platform.displayCaps.platformHeight * 6 / 100,
        width : "94%",
        backgroundImage : "../images/textfield_dropdown.png",
        top : "10",
        paddingLeft : "10",
        hintText : "Input Activity - optional scroll",
        font : {
            16,
            fontWeight : "bold",
        },
    });

合金で

<TextField height="?" id="name_Txt" left ="2%" paddingLeft = "5" backgroundImage = "/appimage/textfield.png" width ="60%"></TextField>

または.tssファイル

"#name_Txt":{
height : ?,
}

前もって感謝します、

4

1 に答える 1

0

このビューのコントローラーファイルでプログラムで実行するだけです。例えば、

main.xmlという名前のビューがあるとします

<Alloy>
    <TextField id="name_Txt"></TextField>
</Alloy>

main.tssという名前のスタイルファイル:

"#name_Txt":{
    left : "2%"
    paddingLeft: 5,
    backgroundImage: "/appimage/textfield.png",
    width:"60%"  
}

そして、main.jsという名前のコントローラー:

$.name_Txt.height = (Ti.Platform.displayCaps.platformHeight< 481) ? 32 : Ti.Platform.displayCaps.platformHeight * 6 / 100;
于 2013-01-31T23:14:37.797 に答える