Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): custom view width in ScrollableView #13933

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Oct 13, 2023

Currently the views inside a ScrollableView are always 100% screen width. This PR allows you to set a custom width to that view. It doesn't allow you to set a value that is bigger than the screen.

simplescreenrecorder-2023-10-13_21.39.26.mp4
var win = Ti.UI.createWindow();

var view1 = Ti.UI.createView({ backgroundColor:'#123', width: 200 });
var view2 = Ti.UI.createView({ backgroundColor:'#246' });
var view3 = Ti.UI.createView({ backgroundColor:'#48b' });
var lbl1 = Ti.UI.createLabel({ text: "scroll left"});
view2.add(lbl1);
var lbl2 = Ti.UI.createLabel({ text: "small view"});
view1.add(lbl2);
var scrollableView = Ti.UI.createScrollableView({
  views:[view1,view2,view3],
  showPagingControl:true,
  currentPage: 1
});

win.add(scrollableView);
win.open();

This allows you to build e.g. Sidebar menus.

Not sure if this is possible on iOS too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant