[英]Is it safe to use GridView in Android?
So I know GridView is deprecated, but is it okay to use GridView for production code?所以我知道 GridView 已被弃用,但是可以将 GridView 用于生产代码吗?
I would like to use it for my game app.我想将它用于我的游戏应用程序。
The Android Studio client says it has been deprecated in favor of ConstraintLayout, but trying to set up a grid (which should be a very simple, straightforward task) is such a hassle using ConstraintLayout. Android Studio 客户端表示它已被弃用而支持 ConstraintLayout,但是尝试设置网格(这应该是一项非常简单、直接的任务)使用 ConstraintLayout 非常麻烦。
So I know GridView is depreciated
所以我知道 GridView 折旧了
GridView
is not deprecated, according tothe JavaDocs根据JavaDocs ,
GridView
没有被弃用
The Android Studio client says it has been depreciated in favor of ConstraintLayout
Android Studio 客户端说它已被折旧以支持 ConstraintLayout
GridView
and ConstraintLayout
are not equivalent things, so that recommendation does not make sense. GridView
和ConstraintLayout
不是等价的东西,所以推荐没有意义。
GridLayout
is comparable to ConstraintLayout
. GridLayout
与ConstraintLayout
相当。 GridLayout
is also not deprecated . GridLayout
也没有被弃用。
but is it okay to use GridView for production code?
但是可以将 GridView 用于生产代码吗?
Both GridView
and GridLayout
are safe for use in production code. GridView
和GridLayout
在生产代码中使用都是安全的。 They are obsolete, and I would not recommend that anyone use them, but they are safe.它们已经过时,我不建议任何人使用它们,但它们是安全的。
If what you want is a scrollable container of items in a grid, you can use GridView
, though RecyclerView
and GridLayoutManager
would be a better choice如果您想要的是网格中项目的可滚动容器,您可以使用
GridView
,尽管RecyclerView
和GridLayoutManager
将是更好的选择
If what you want is a non-scrollable container of items in a grid, you can use GridLayout
or perhaps TableLayout
, though ConstraintLayout
would be a better choice如果您想要的是网格中不可滚动的项目容器,则可以使用
GridLayout
或TableLayout
,尽管ConstraintLayout
将是更好的选择
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.