Android studio recyclerview tutorial3/9/2023 We can have different rules for interaction inside the View. The ViewGroup also enables us to define how the children are organized inside the view, for example, are laid our vertically or horizontally. together and the structure that would hold that would be what we call the ViewGroup Var nestedArr = //in our anology, we can now group views Var arr2 = // We can imagine this as another simple view but we could imagine there's one that makes it easy to use numbers we can imagine this as a NumberTextView which doesn't really exist var arr1 = //imagine a simple View as an Array Given that an Array of Arrays is an Array itself, we can see how a ViewGroup can be treated like a View. We can image a View as an Array and a ViewGroup as an Array of Arrays. In this case, the View that’s created at the top level that we add other simple views(we can also add viewGroups) to is called the “parent,” and the views that are added inside are “children”. The ViewGroup class is a kind of View but, unlike the simple View class whose responsibility is simply displaying, the ViewGroup gives us the ability put multiple views into one view, which we can reference as a whole. The View class provides methods we can override to draw on the screen and a means to pass in parameters such as width, height, and our own custom attributes we would want to add to our View to make it behave as we would wish. It’s possible to create our own custom views to be able to achieve more flexibility when developing user interfaces. EditText extends from the same View class and adds more functionality to enable the user to input data. TextView, for example, has a simple purpose of displaying text content on the screen. These classes are abstract and are extended to different implementations to suite a use-case. The Android platform uses the View and ViewGroup classes to draw items on the screen.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |