‫We'll come back.
‫We'll continue with the XML layout editor in Android studio and learn about the view attributes in Android
‫studio.
‫When you are working with the layout files, the XML files to design the user interface for your Android
‫app, you use various view attributes to define how each UI element should appear and behave.
‫These attributes are specific to different types of view widgets and allow you to customize their appearance,
‫layout, behavior and interactions.
‫Let's learn about some common view attributes in Android studio.
‫The first attribute is the ID.
‫This attribute assigns a unique ID to the view.
‫You can use this ID to refer to the view in your Java or Kotlin code to programmatically manipulate
‫it.
‫Layout, width and height.
‫These attributes define the width and height of the view.
‫You can set these values to specific dimensions like wrapcontent, matchparent, or a fixed size if
‫you set it to matchparent.
‫You can see it will match the parent view, which is the whole layout.
‫You can set a specific size, for example, 200 DPI and you can see the size of it.
‫Android text for text view and its subclasses.
‫This attribute sets the text content to be displayed.
‫For example, if I change it to Hello my friends and you can see it changed here.
‫These attributes are specific for the constraint layout.
‫Two constraint This view with the dimensions of the specified dimension in the middle of the later on
‫when we talk about constraint layout, we'll deep dive into these attributes.
‫There are a lot of other attributes you can use.
‫Android Smart layout margin.
‫So this attribute it specifies the margins or the empty space around the view separating it from the
‫other elements.
‫So for example, if I set it to 20 DPI, if I add Android padding, this padding adds extra space inside
‫the view, creating a gap between the View's content and its boundaries.
‫So for example, if I put 40 DPI, you can see that the end making 40 DPI between the view itself and
‫its content.
‫These are just a few examples of the many view attributes available in Android studio.
‫The specific attributes you use will depend on the type of the view you're working with and the desired
‫behavior and appearance you want to achieve.
‫Android Studio's layout editor provides a visual way to edit these attributes.
‫If we go to the attributes tab here and let's say I need to change the padding, I can set it here.
‫Like for example, from 40 to 60 DPI, click enter and you can see that the padding is increased.
‫Also, there are a lot of things and attributes you can edit here in this visual editor.
‫Like for example, if I need to increase the size of this text view for 3434 SP, you can see that the
‫font increased.
‫If I need to change the color of this text, I click on this click okay.
‫And here we've added a text color and the text size attribute to the XML file and you see it in the
‫visual editing.
‫So either you can edit with the code or the attributes by this visual attributes editor.