Android gets me soooo hot, you too?
In this lesson we’re going to setup the layout of our pickup app. Here is what our app will look like, two buttons to get clean and dirty pickup lines, and then another screen to display the pickup line, along with a button to try again if they’re not that into you, but i’m sure they will be. The first layout is set up with the main activities XML file.
So delete hello world by clicking on it and pressing delete, we can also select stuff in the component tree view to the right. Now we’ve got a blank canvas, select the text view. We’re going to change the layout to Linear layout and delete this padding, notice that it’s highlighted green, this means its referencing another file, if we click on it we see the @ sign, in this case the dimens dot xml in the values folder. That’s a file where you can standardize dimensions. Android handles a lot of defaults this way and when you see an @ sign that means its referencing a file somewhere. For now delete the padding, for this app we don’t need more cushion for the pushin. Next we’ll add the attribute android orientation vertical, to make whatever we put into this layout arrange itself vertically. Look back at the design view and we’ll see the padding is gone.
Let’s split this vertical layout into two halves by adding two relative layouts. Select relative layout, then mouse over linear layout in the component tree and click to add it. You don’t need to drag, but you can. Do it one more time for the second half. We don’t see much change in the design, to make each relative layout take up half the screen find layout weight in properties and change it to .5, linear layout allows you to weight things inside, weight of 0.5 tells each relative layout to take up half the space.