From the course: Programming for Non-Programmers: Android & Kotlin

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Grid layouts

Grid layouts

From the course: Programming for Non-Programmers: Android & Kotlin

Start my 1-month free trial

Grid layouts

- [Instructor] Our next goal is to lay out all of our buttons. We want them to be in a grid pattern like the screenshot shows of the finished calculator. Let's head over to Android Studio and into Activitymain.xml. Our first task is to get a grid layout from the pallette window. I'll click the Search button and search for grid in the pallette window. There are three different options here. Grid layout, Grid view, and another Grid layout. The one that you want is the Grid layout at the top. So just click and drag that into your user interface, and you get a rectangle selected right here. The first thing we'll do is add the constraints. And we'll do it just like we've done before. Click and drag from the circle handles to the edges of the screen. All the way to the top edge right there, and then click and drag to the bottom for the bottom handle. And then left, and right. So you should have all the constraints, and with the grid layout selected, look over into the Attributes window. And…

Contents