简体   繁体   English

制作适用于Android的可滚动应用程序?

[英]Making a scrollable app for Android?

I'm trying to make an app with a grid of images/buttons that starts different process on my PC from my Android phone but I'm having a hard time making it "scrollable" now that I've run out of space on the main screen. 我正在尝试制作一个带有图像/按钮网格的应用程序,以在我的Android手机上的PC上启动不同的过程,但是由于我的屏幕空间不足,我很难将其设置为“可滚动”主屏幕。 How do I utilize the scrollbox items? 如何利用滚动框项目? I'm having one right now but it doesn't work at all. 我现在有一个,但根本不起作用。 I read somewhere that the items withing the scrollbox needs to be bigger than the scrollbox boundaries but how do I make my next 4x4 grid show up within the box then? 我在某处读到,带有滚动框的项目必须大于滚动框的边界,但是接下来如何使我的下一个4x4网格显示在框中? I know I could use panels and just a simple "1, 2, next" system but I'd rather have it scrollable and preferably endless scroll so if I get to the last page it will return to page 1. I don't have any code at the moment to provide but I have this picture to show. 我知道我可以使用面板,也可以使用简单的“ 1、2,下一个”系统,但是我希望它可以滚动,最好是无休止地滚动,所以如果我到达最后一页,它将返回到第1页。我没有目前提供的任何代码,但我要显示这张图片。 I want another grid like this if I swipe to the right or left. 如果我向右或向左滑动,则需要这样的另一个网格。 I don't know really how to describe it in any other way, hope you can help me out. 我真的不知道该如何用其他方式来描述它,希望您能对我有所帮助。

You need to place a control such as a TLayout as the immediate child of the TScrollBox. 您需要将TLayout之类的控件放置为TScrollBox的直接子级。 Set it's Position at (0,0) and Height/Width as necessary for your controls. 根据控件的需要,将其位置设置为(0,0)并设置其高/宽。 This size is what is used by the scroll box for it's scroll bars. 此大小是滚动框用于其滚动条的大小。

Then place your actual controls onto the TLayout. 然后将实际控件放到TLayout上。 As you add or remove controls, resize the TLayout and the scroll box will adjust it's scroll bars as necessary. 添加或删除控件时,调整TLayout的大小,滚动框将根据需要调整其滚动条。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM