Lesson: 21 – Layout (ScrollView and LinearLayout) in Kotlin

Hello viewer, You can now have our Tutorial Lessons in your android mobile device and read it offline.
Download kotlin Programming APP on PlayStore
Download Website SEO Lessons APP on PlayStore

The ScrollView along with a LinearLayout allows us to have a number of visual components that exceed the amount of space of the viewer of the phone or tablet. Then the user can move the created interface with his finger.

Problem:

Create a project called: Proyecto023 and have control ScrollView type (found in the “Containers” tab) as we can control then we will see that our Scroll View is within “Linear Layout” control:

 

Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin - Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin - Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin -

Now we will have 20 objects of class within the LinearLayout Button (we can do it directly in the window or by dragging the buttons to the “Component Tree” window within the object “LinearLayout”):

 

Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin - Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin - Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin -

We continue dragging buttons inside the LinearLayout until we reach 20 (then change the text property), as we can see there are more buttons inside the LinearLayout than the ones that can be displayed in the interface of the device:

 

Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin - Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin - Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin -

Thanks to the functionality of the ScrollView next to LinearLayout now at runtime we can scroll:

 

Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin - Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin - Lesson: 21 - Layout (ScrollView and LinearLayout) in Kotlin -

We can arrange objects of different types within the LinearLayout (Button, EditText, TextView, etc.)

…..

About The Author

Related posts

Leave a Reply