How to Implement ScrollView in Sketchware

Too much content? No worries. Scroll away!

Sung Park
Sketchware
3 min readApr 20, 2017

--

Being able to scroll through content is a very important feature in an application. It’s very useful when delivering a lot of content to the user, such as a long text, or a list of indefinite amount of information. As you’re reading this article, you’re probably scrolling down to read more about it.

However, this feature doesn’t get implemented automatically. Today, we’re going to talk about how you can implement ScrollView to make a view inside your android application “scrollable.”

What you’ll need

  1. Sketchware — a mobile IDE on your smartphone
  2. Passion to learn! :-)

What you’ll learn

  1. How to implement ScrollView in Sketchware

Understanding ScrollView

ScrollView is literally a view that can be scrolled. By its nature in Android Programming, it can only take in one child widget. What does that mean?

First, let’s understand the concept of “parent” and “children” before we move on. Here is an example of TextView inside a Linear Layout:

TextView inside a Linear(V)

Since the layout wraps the TextView, TextView is a child of the layout and it’s the only child. The hierarchy looks like this:

This layout holds three children. You’re getting the hang of it, right? So back to the important point, ScrollView can only hold one child.

Whatever the ScrollView takes in, it will allow that widget to be scrollable. If we were to add a LinearLayout inside the ScrollView, it would make LinearLayout scrollable. This means all of LienarLayout’s content will become scrollable. Take a look at the widget below:

The hierarchy looks like this:

Since this makes LinearLayout scrollable, you can add an indefinite number of widgets inside this view. When you add too many widgets to a point where it overflows the screen, you will notice that you can scroll through them. This is usually not possible with a regular linear layout.

What to watch out for

It’s possible to add a ScrollView inside a ScrollView, but always keep in mind that ScrollView only takes in one widget. I recommend using a LinearLayout as the ScrollView’s child, which allows you to add more widgets inside the LinearLayout. Then, you could add multiple ScrollViews inside the LinearLayout. It could be mind-boggling at first, but you will eventually have an “ah-ha!” moment.

Conclusion

We talked about how we can implement ScrollView in Sketchware. There are few things you should really take away from this article:

  1. Whatever goes inside the layout becomes the “children” of the layout.
  2. By its nature in Android Programming, ScrollView can only take in one child widget.
  3. It’s generally the best to add LinearLayout as the ScrollView’s child.

That’s it. Happy coding! :-)

If you enjoyed this article, please press the 💚 below so others can find this article too!

--

--