質問

AppceleratorチタンのAndroidとiPhoneの画面の下部にフッターメニューをドッキングするにはどうすればよいですか?画面の下部に3つのアイコンを表示したいと思います。

役に立ちましたか?

解決

使った Titanium.ui.view 底を設定します:0に底にドッキングするようにします。

他のヒント

はい、これにはti.ui.toolbarを使用します。この例コードを見てみましょう。

var space = Titanium.UI.createButton({
    systemButton: Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});

var buttonNextEnd = Titanium.UI.createButton({
    title: '>>'
});
var buttonNext1Page = Titanium.UI.createButton({
    title: '>'
});
var buttonPrevEnd = Titanium.UI.createButton({
    title: '<<'
});
var buttonPrev1Page = Titanium.UI.createButton({
    title: '<'
});

var toolbarNav = Titanium.UI.createToolbar({
    left : 0,
    bottom: 0,
    height : 40,
    width : 320,
    items: [buttonPrevEnd,space, buttonPrev1Page,space, buttonNext1Page, space,buttonNextEnd]
});

win.add(toolbarNav);

使用する Titanium.ui.toolbar そのために。

Appceleratorを使用している場合 合金フレームワーク

XMLビューのコード

<Alloy>
    <Window title="My Nice Title">
        ...   ...   ...
        ...   ...   ...
        <View class="footer-menu"></View>
    </Window>
</Alloy>

TSSのコード

".footer-menu": {
    backgroundColor: 'red',
    width: '100%',
    height: 40,
    bottom: 0
}

これにより、ビューが底に押し上げられます。これがスクリーンショットです。

enter image description here

合金を使用していませんか? JSでも似ています。

// create window     
var win = Ti.UI.createWindow({
    // if anything
});
// create view
var footer_menu = Ti.UI.createView({
    backgroundColor: 'red',
    width: '100%',
    height: 40,
    bottom: 0
});
// add view to window
win.add(footer_menu);

これが役立つことを願っています。ありがとう!

var footer = Ti.UI.createView({

    height:25
});

var footerButton = Ti.UI.createLabel({

    title:'Add Row',
    color:'#191',
    left:125,
    width:'auto',
    height:'auto'
});

footer.add(footerButton);

Androidで動作しますが、ボタンがiPhoneに表示されない理由はまだわかりません

ツールバーはAndroidやタブレットと互換性がないことを忘れないでください。

画面の下部にボタンを設定する場合は、ビューを作成し、下部に設定してから、画面の幅を考慮して、相対位置でボタンを配布します。

これが例です:

    function FirstWindow() {
    var self = Ti.UI.createWindow({
        background : "black",
        height : "auto",
        width : "auto",
        layout : "vertical"
    });

    teste = Ti.UI.createView({
        left : 0,
        bottom : 0,
        opacity : .7,
        backgroundColor : "#3d3d3d",
        height : 55
    });


    var button1 = Ti.UI.createButton({
                title : "button 1",
        left : 0,
        width : Titanium.Platform.displayCaps.platformWidth * 0.3
    });
    var button2 = Ti.UI.createButton({
                title : "button 2",
        left : Titanium.Platform.displayCaps.platformWidth * 0.33,
        width : Titanium.Platform.displayCaps.platformWidth * 0.3
    });
    var button3 = Ti.UI.createButton({
                title : "button 3",
        left : Titanium.Platform.displayCaps.platformWidth * 0.66,
        width : Titanium.Platform.displayCaps.platformWidth * 0.3
    });
    view.add(button1);
    view.add(button2);
    view.add(button3);

        self.add(view);

    return self;
}

module.exports = FirstWindow;

これを行う...あなたはビューのボタンを配置しています。

最初のボタン(Button1)は「左:0」で始まり、ビューの30%の幅があります。 2番目のボタン(Button2)は、最初のボタンとスペースなどの後に始まります。

そして、それらの高さはビューと同じです。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top