Instructor>Hello and welcome. In this lesson, you will learn about custom views foundation. So in your applications, especially your mobile apps and your Android apps, you will want to create standard views and also custom views using Kotlin. So it's a good thing to learn how to draw shapes and create a canvas and use your XML attributes in a way that's gonna give your customers a good user experience. So the Android platform has several view classes that cover the standard needs of a typical application, but sometimes even a lot of times, these views do not fit the needs of your customers, and you're gonna need to build custom views. And some of those reasons are you might have different types of data that you need to display and the standard views just can't handle it. Or maybe you want a different type of user interaction. We're all accustomed to using the same type of interaction over and over. But maybe for your app, you want something special and something different. Or maybe you want a really neat type of animation. Or your user interface design has to be innovative and new. There's also performance issues where you need to optimize the speed and delivery of your performance. And then there's always reusability. So we need to learn how to draw or create some custom views so that we can bring forth some unique shapes and unique paths by using what's called the Android canvas. So overall, we can think of this as a Canvas. This area here is where we're going to paint or create the look and feel of our app. And this is our layout. And we can think of this layout as a canvas. And right here in Android Studio, we have what's called a palette. So let me click on this palette. And this shows us kind of a view hierarchy. So at the top of the hierarchy is the view class. And then underneath that all within the view class are widget views and button views and text views and different types of groups of layouts. Now the ways to create a view is you can create a view within this layout by dragging a view onto your palette. And you can also create views within your code, which is right here, views within the main activity, or you can create views within the activity main, which is actually the layout. So for instance, you can add a text view, I'll click on that. And there's several different of text views, plain text, passwords, and phones and emails and all sorts of things. And this layout view is contained within the res layout activity main, but you can also create views by going into the main activity. Okay, so these views, they're the basic building block of the Android user interface or the UI. And you can think of a view as any type of rectangular area on the screen that either you've drawn yourself or you've used the layout tools. And you can create a view group, which is a subclass of the V class. So sometimes you want to show a certain type of data and there might be a suitable view or a good view. And within the basic widget set like these image views and these web views and these video views, calendars, progress bars, ratings bars, there might be some really good things there, but sometimes you want to take that and then customize it, or you want to build it from scratch, which is also a custom view. So you might be to extend these widgets. So for instance, let's pretend that there was no such thing as a button view because in the old days there wasn't. And you had to create it yourself. So what you can do and what you can still do is within a text view, you can actually extend the text view and give it some parameters and a frame and then all of a sudden you can turn your text view into something that looks like a button, and that would be a custom view. And then of course you can reuse that button because you created it, you own it, it's now a class unto itself and it's reusable. And you can even have a view group where you would take a lot of similar views and group them together. For example, you might have a group called the money view where you would have some text views that talk about money and then you would have some image views that might have a dollar sign, and you would group these views all together so that you can call them as one package and deploy them quickly as a group. And the view classes in Android all have what we call constructors. And there are four constructors that you need to use or override. One of those constructors is the activity context. And another is view instance, which relates to XML. And there's also the style and the theme attribute. And then you have a style resource. And all of these can be worked through using XML. So when you're creating custom views, you're actually drawing on a canvas and that canvas is going to need things like color, themes, and strings. Here's some code that works with these attributes. You're gonna be working with colors, such as red, green, blue. You're gonna be working on a canvas and you're gonna be working with paint brushes. When we use custom views, we're actually overriding what's already there. That's what makes it custom, the overriding. All right, so that's a good overview of custom views. So that concludes our lesson on custom views foundation. Thanks for watching. Stay tuned for the next lesson. So let's go.