Layouts in Android Studio | Android Tutorial #20

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys in this tutorial we will see the different types of Android layouts and what is each type so first of all we have different types of Android layouts we will deal with the most common and the most used layouts so the first of all we will see the linear layout in its different types its different orientations their relative layout and the grid and the scroll view we we will see them later this grid view and scroll view and other next future videos so now we will see the linear layout and the relative layouts what are these layouts so linear layout like its name suggests all elements are displayed in linear fashion below is an example of the linear layouts so linear layout will we see them next next to a couple of minutes either horizontally or vertically and this behavior is a set as Android orientation so Android layouts linear layouts group their widgets or its views and in a pattern or oriented movement oriented the direction like horizontal or vertical which is an attribute of the not linear layout we will see them in details how widgets are group in linear pattern also we will learn about the new Android new layout which is called constraint layout and we will see them or we will deal with constraint layout in whole our course in all of course so the constraint layout which is very which is which is you which is used to anchor the widgets inside it and a constraint layout so and this figure we will see like number one if we click on that we will see them also an a real Android app but till now let's put this figure and learn it and learn more about it so when selecting a view that tributes window includes the controls for one this ladder rectangle the sorry that triangle size ratio it will constraint widget according to size ratio number two deleting a constraint would be newly introduced by clicking ctrl + R at the right click left click of the mouse and three the height width mode the four margins and constraint bias number five you can also highlight individual constraint in the layout editor by clicking on them and the constraint layout will see them basically and in details next couples of minute like an example of the constraint layout which is the most powerful layout used in the Android studio especially especially for complex layouts and designs so if you see on the left side this is what the users see but in in the in fact the layout or the layout is more complex and is used or designed by the constraint play out so the constraint layout is a very importantly out we used in Android we will use them and I advise you to use this type of constraint layout in all your of your projects till now it's very good and let's dive in in our Android studio and see each type of layouts how it behaves and how the constraint layout is powerful layout is define is structure of their user interface in your app such as an activity so all elements and the layout are built using a ratio of view and view group objects we will see later what are new groups and view so if you usually draw something the user can see and interact with so so imagine that this layout called activity main.xml all LEDs are dot XML and written in XML so say a user will see this page in front of him or in front of his phone so if the layout is something that the user will see and that dot Java are the files where the code are executed without the user they were displaying so we will see the different type types of layouts whereas a view group is an individual invisible containers that define the layout structure for review and other groups ok the view objects are usually called widgets so as we see before these are the widgets like it would just like textview button image view recycler view and we see later on a scroll view and switch but the layouts are the aim containers that arrange these views inside in a pattern or they are arranged in a way that they are grouped and displayed to the user as a programmer or developer put or say or design so let's begin so what are the different types of layouts so click here on the layouts we see on the Android studio 3.5 and previous versions of it that the constraint layout is would be a default layout of this Android stay so constraint layout is a new layout pattern that allows you to create large and complex layouts with a flat view hierarchy no nested view groups it's similar to relative layouts we will see later what are the relative layouts so constrained is basically as a relative layout so what are little tips relatively array layout as its as its name indicates it's it's not nearly as simple as they like linear or frame layout we'll see also them relative layout shows a large number of attributes all focused around positioning children relative to the edges or center of relative layouts so the widgets are relative position and relative to each other relative layout relative position frame layout what are the frame layout acts is quite different compared to linear and relative so frame layout constraint layout linear layout and relative layout let's start seeing them in front of us constraint a out here are the constraints so these blue lines are constraints so whenever you add a widget whenever you add a new widget like I it will be without constraint so but in order to create this constraint I pull this line to the left so the widget will be displayed in this position and I create a top constraint and to the left if I want the textview it will be here it will be displayed in this pattern so if I wanted this text to be displayed in the center in the center of screen I would use it for constraints as this so I click on the attributes panel I can press here and I can use these methods or these types of of constraint widgets types so there are wrap content and I think this is the fixed position and this is called match match constraint constraints so let's see consider the layout and see the difference so match pattern of match constraint will match there the relative size of the relative height so if I click on this also it will match the screen and the path that the child of the parent layout so the parent layout in this case is called is constraint layout so the text I created will make a match constraint relative to its parent layout if I click on the match constraints match wrap content it will wrap the text and according to its size so let's add another widget so I will add a button here so if I need to to constraint or to anchor this about the load the text view I just add the constraint of the button and I can move it and I can constrain tell button the button also to the left and to the right if you have the blue line here you can the blue line edge you can constraint it so now the button is constrained to the left and right and to the text if I want also add more widgets so let's try now to see the other layouts I would create a linear layout here below I will remove the button I will remove the text I will create the linear layout linear layout it would be matching all the size the constraint and now I can add widgets inside the linear layout so you can put it below if I add another button it's our they are arranged and linear layout or linear pattern if I want to see or change the attribute of Y displaying them in a horizontal way or in a vertical way I can go to text linear and Android orientation I can put horizontal and see that what's happening okay so the buttons are arranged here are arranged here in a different way so as we see we put here the buttons also I can use the attribute of the width match parent and the height wrap content let's wrap our content I will remove in order to remove the constraint we click on ctrl and click on the mouse that the blue light the red line will be displayed red line is for deleting so I can add the text I can add the text outside the linear so till now in this app I have a textview that is inside the main constraint I have a linear layout that it is on the main screen this is Lily the linear layout I can constraint it the texts so this is the text I will click it I would click the text increase its size and see what's happening and how and how the Android will respond to this and let's say lay out app layouts app okay so this is our this is our app they the Linnaean layout okay I will remove I will remove this constraint it will attract under the textview now let's see the other layouts horizontal let's create a horizontal horizontal linear layout let's say it's zero zero zero and this is the layout under under it and the height would be wrapped content so the linear layout this is the linear linear - I would use linear layout and linear layout - and I will add some button inside the linear layout bottom number 6 and pattern number 7 bottle number 8 ok guys so we are making the the layout the layout they are as a constraint layouts so we have a to two linear layouts this is linear arranged vertical and this is a linear layout arranged in a horizontal way and this is the text they are all in the constraint layout there's a blue line indicates which the component is select which component is selected constraint layout text layout layout and we can also create another laid out like frame layout table table row and space I will see them later on also guideline and guidelines also in a recycler view and card view later on thank you guys and see you next videos you
Info
Channel: Master Coding
Views: 135,926
Rating: undefined out of 5
Keywords: material layout android, relativelayout in android studio, ui design android studio, layouts in android, android xml design, android development tutorial, android tutorial, android xml layout design tool, android studio layout, android studio design view, app layout, android, relativelayout, relative layout in android, relative layout, relativelayout android, relativelayout in android, android studio, constraintlayout android tutorial, android constraintlayout
Id: OCceWupZ_Ik
Channel Id: undefined
Length: 19min 5sec (1145 seconds)
Published: Sun Jan 05 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.