Domanda

I want to put a back button at top left on the scrollableView of iPad. If I put a button here doesn't appear on the screeen.

This is my view1.xml.

<Alloy>
    <Window id="win1" class="contain">
        <ScrollableView id="scrollableView" showPagingControl="true">
            <View id="vista1" backgroundImage="Lois1.jpg"></View>
            <View id="vista2" backgroundImage="Lois2.jpg"></View>
            <View id="vista3" backgroundImage="Lois3.jpg"></View>
            <View id="vista4" backgroundImage="Lois4.jpg"></View>
            <View id="vista5" backgroundImage="Lois5.jpg"></View>
        </ScrollableView>
    </Window>
</Alloy>

This is my alloy.js:

//View 1
var win1 = Ti.UI.createWindow({
    fullscreen: true});

var vista1 = Ti.UI.createView({ backgroundImage: 'Lois1.jpg'});
var vista2 = Ti.UI.createView({ backgroundImage: 'Lois2.jpg' });
var vista3 = Ti.UI.createView({ backgroundImage: 'Lois3.jpg' });
var vista4 = Ti.UI.createView({ backgroundImage: 'Lois4.jpg' });
var vista5 = Ti.UI.createView({ backgroundImage: 'Lois5.jpg' });

var scrollableView = Ti.UI.createScrollableView({
  views:[vista1,vista2,vista3,vista4, vista5],
  showPagingControl:true
});

win1.add(scrollableView);
È stato utile?

Soluzione

If you are not able to add button in view1.xml then you can do that in view1.js

so try to add below code in your view1.js file

var btnClose = Ti.UI.createButton({
    title : "Close",
    width : Ti.UI.SIZE,
    height : Ti.UI.SIZE
});

$.scrollableView.add(btnClose);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top