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.

ahmadPH
  • 135
  • 11
CodigosTutoriales
  • 1,018
  • 1
  • 10
  • 21

1 Answers1

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.

rosghub
  • 8,924
  • 4
  • 24
  • 37
  • 1
    Wait a moment, Does `RecyclerView` do the job of both list and grid view? Interesting – CodigosTutoriales Apr 28 '18 at 17:50
  • 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." – rosghub Apr 28 '18 at 17:53
  • 1
    But, how can `ConstraintLayout` replace `GridView`? AFAIK `ConstraintLayout` doesn't act as a collection of clickable items like `GridView` does. – CodigosTutoriales Apr 28 '18 at 18:11
  • 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). – rosghub Apr 29 '18 at 18:28
  • 3
    FYI: `GridView` has been replaced by `RecyclerView` coupled with [`GridLayoutManager`](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager). – marcianx May 10 '20 at 21:15