Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Bug with ScrollView?

$
0
0

Am I using the ScrollView correctly or have I discovered a bug? It seems that the entire ScrollView will disappear if:

a) The ScrollView is added as the second view to a window with horizontal layout

and

b) Enough views are added to the ScrollView so that they are not all visible at the same time within the ScrollView.

Here is my Alloy code-

index.xml:

<Alloy>
    <Window class="container" layout="horizontal" width="Ti.UI.FILL" height="Ti.UI.FILL">
        <View id="leftView" width="200dp" height="Ti.UI.FILL" />
        <ScrollView id="scrollView" layout="horizontal" width="Ti.UI.FILL" height="Ti.UI.FILL" />
    </Window>
</Alloy>
index.tss:
".container": {
    backgroundColor:"white"
},
 
"#scrollView": {
    borderColor: 'green',
    borderWidth: '2dp',
    backgroundColor: 'red',
    contentWidth: "auto",
    contentHeight: "auto",
    horizontalWrap: false,
    scrollsToTop: false,
    showHorizontalScrollIndicator: true,
    showVerticalScrollIndicator: false,
    horizontalBounce: true,
    verticalBounce: false
}
index.js:
var numViews = 10;
 
var views = [];
 
var params = [
    { color: "#333", text: "Label 1" },
    { color: "#444", text: "Label 2" },
    { color: "#555", text: "Label 3" },
    { color: "#666", text: "Label 4" },
    { color: "#777", text: "Label 5" },
    { color: "#888", text: "Label 6" },
    { color: "#999", text: "Label 7" },
    { color: "#aaa", text: "Label 8" },
    { color: "#bbb", text: "Label 9" },
    { color: "#ccc", text: "Label 10" },
];
 
function createViews() {
    function createView(args) {
        var view = Ti.UI.createView({
            width: "240dp",
            height: Ti.UI.FILL,
            backgroundColor: args.color
        });
        var label = Ti.UI.createLabel({
            text: args.text
        });
        view.add(label);
        return view;
    }
 
    for (i = 0; i < numViews; i++) {
        var view = createView(params[i]);
        views.push(view);
        $.scrollView.add(view);
    }
}
 
createViews();
 
$.index.open();
I'm using Titanium SDK 3.2.3 and Alloy 1.3.1. Try creating a new Alloy project with the above code, and when run in the iPad simulator using landscape mode you'll see just a blank white screen. Changing numViews to 3 will cause the ScrollView to appear. Removing leftView from index.xml will also cause the ScrollView to appear.

This sure seems like a bug to me.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>