Android App Development for Beginners - 17 - GridLayout

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

For Android Studio 3.0, the following steps should work:

1. Adding GridLayout: As per the video.

2. GridLayout wrap_content: In the Attributes for the GridLayout, set layout_width and layout_height to wrap_content. (There should be a drop-down option.)

3. Adding CENTER button: Drag the Button onto the GridLayout within the Component Tree. Text can be set from the text field in Attributes.

4. Adding the RIGHT button: Drag the Button onto the CENTER button added previously, within the Component Tree.

5. Adding the LEFT button: Drag the button onto the GridLayout in the Component Tree. This should insert the button before the CENTER button.

6. Adding the BOTTOM button: Drag the Button onto the RIGHT button in the Component Tree. This will put it on the same row in the 4th column. To change this, select the GridLayout and view all attributes. Set columnCount to 3. BOTTOM should now be wrapped to the next row.

7. Column / row spans: The attributes are called layout_rowSpan and layout_columnSpan.

8. Layout gravity: As per the video.

RichJInnocent
Автор

Chill bucky, I'm trying to finish all your videos but your pumping them out so quickly!

MEzeroTM
Автор

You dont need to drag, only by clicking the widget its selected and then you click any place where you want to put it.
Great video, you're awesome Bucky!

andresar
Автор

A few things on this. For android studio 2.2 drag the button from the widgets area, into the component tree as a child of the gridlayout. Now in your grid layouts properties, click view all properties. For columnCount select 3. Now you'll be closer to the functionality buckey's got here. The next items you're looking for to complete the tutorial are layout_rowSpan and layout_gravity. I had to add these options directly into the XML.

rmrbush
Автор

7 years later and this is still the best tutorial for android app development. Many things have changed, and I am not even using Java (but Kotlin instead), and still, it's the most useful tutorial!

stefanosmandalas
Автор

For those who are using android studio 2.2, here's how I make button as child of GridLayout: just drag the button to the GridLayout in the Component Tree. That works for me.

van-nhantran
Автор

MORE THAN A DEVELOPER, YOU ARE A FANTASTIC TEACHER :)

ravigupta-ekmi
Автор

You are an AWESOME teacher. Thank you.

DiversEvent
Автор

Brilliant video. You can make amazing layouts with Grid. Your video just opened up a plethora of ideas!

zeeshanparvez
Автор

To move buttons for those using android 2.2 or newer version. (You don't see those green button's like Bucky)

- Select GridLayout from Component Tree and open properties.
- In layout_width column set "Match_parent" instead of "Wrap Content". Do same for Layout_height
- Now you see gridlines once you drag buttons. Drag button from one place to other or stretch buttons.
- Set GridLayout properties for Layout_Width and Layout_height back to Wrap_Content, one you are done

Hope this helps.

varunrao
Автор

Pretty much none of these work for me :/

koski
Автор

Hi Bucky,

I'm really enjoying the tutorial videos. I've made it up to #17 so far with great success but am having a lot of trouble with this tutorial for some reason. I am using Android Studio 2.2 on OS/X.

I've created the new project, just like before, selected Material Light for the theme, and dragged a GridLayout into the Design window of activity_main.xml. However, every time I try to drag a button (or anything) into the GridLayout, there is no option to insert before/after a row/column. Additionally, I cannot drag anything into the GridLayout at all; when I drop it over the GridLayout, the button disappears and nothing happens (i.e. the Component Tree shows no new button). I've gotten a couple of "NullPointerException null" errors from Android Studio itself with an offer to submit the report to Google and did so but even after quitting Android Studio and restarting several times, I still can't get the UI to do anything with GridLayout.

I seem to have success coding everything manually in the Text section of activity_main.xml but that sort of defeats the purpose of the UI, right?

If you could offer any advice, I'd be greatly appreciative!

retsigam
Автор

Bet I'm your oldest student - 54?. Just learning Android Development. Just one problem. I'm running A.S. on Linux (Ubuntu 15.04) and I don't get the "little green bars" - I had to take the rendering down to 21 from 22 to get it working and I'm using KVM as I've got an AMD processor.

PaulWardEssexUK
Автор

I'm unable to get those green bars that indicate the rows and columns. Any idea how I could get them?

RogerAmanna
Автор

Thanks for the tutorial Buckey. You have a great teaching style.

oldnsad
Автор

Bucky, i LOVE you so much! As a brother though :D Thank you a ton!

sexantrop
Автор

gotta a couple of questions, mate. Grid has to always be nested to another kind of layout? Is it good practice to use multiple grids within a layout?

riskromer
Автор

hi what was the use in previous videos where we were creating interface with java? why didnt we drag and drop isnt it more simple?

dimitriszerkelidis
Автор

How can we make that greed to fill whole screen, I mean to fill that white space on right?

knuseski
Автор

Im using android 2.3 and im absolutely not doing like him! Anyone know how the get some "type" off model as him? Im working with constrains and giving them different lenght ect

sphxcyprex
join shbcf.ru