Why are some views located inside the legacy tab in Android Studio 3.1 and what replaces them?
Asked Answered
A

1

49

I've updated my Android Studio to 3.1 stable channel. I've noticed that "All" tabs in palette window are removed and "Legacy" tab is introduced. That tab contains the following:

The new Legacy tab in AndroidStudio that contains GridLayout, ListView, TabHost, RelativeLayout and GridView

  • ListView
  • TabHost
  • RelativeLayout
  • GridView

I didn't mention the GridLayout because it's a downloadable dependency rather than a View from the Android APIs.

Which new Views have replaced the views mentioned above?

I know ConstraintLayout replaces RelativeLayout, but what replaces the ListView, the GridView or the TabHost? I want to be up-to-date.

Alastair answered 28/4, 2018 at 17:4 Comment(0)
L
74

ListView - replaced with RecyclerView

TabHost - replaced with TabLayout

RelativeLayout - replaced with ConstraintLayout

GridView - replaced with ConstraintLayout

Mostly due to the new ones having better performance.

RecyclerView.Adapter has implemented the popular and recommended holder pattern and supports modern layout transitions. It also accepts a layout manager allowing you to easily implement a grid.

Luciferase answered 28/4, 2018 at 17:25 Comment(5)
Wait a moment, Does RecyclerView do the job of both list and grid view? InterestingAlastair
My mistake, ConstraintLayout replaces GridView. From the documentation for ConstraintLayout: "A view can be a part of both a horizontal and a vertical chain, making it easy to build flexible grid layouts."Luciferase
But, how can ConstraintLayout replace GridView? AFAIK ConstraintLayout doesn't act as a collection of clickable items like GridView does.Alastair
You may be right, full disclosure I never fully leaned the ins and outs of ConstraintLayout but I do know Google seems to recommend them in a lot of places. It seems to cover the functionality of every layout but improves on performance during measurements. But doesn't really do much in terms of add new functionality. You might want to have a look at it's documentation (it's huge lol).Luciferase
FYI: GridView has been replaced by RecyclerView coupled with GridLayoutManager.Cece

© 2022 - 2024 — McMap. All rights reserved.