问题
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:
- 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.
回答1:
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.
来源:https://stackoverflow.com/questions/50079026/why-are-some-views-inside-the-legacy-tab-in-android-studio-3-1-and-what-replaces