android - 在 Android 中使用 GridView 是否安全?

标签 android android-gridview

所以我知道 GridView 已被弃用,但可以将 GridView 用于生产代码吗?

我想将它用于我的游戏应用程序。

Android Studio 客户端表示它已被弃用,取而代之的是 ConstraintLayout,但尝试设置网格(这应该是一个非常简单、直接的任务)使用 ConstraintLayout 非常麻烦。

最佳答案

So I know GridView is depreciated


GridView根据 the JavaDocs 未弃用

The Android Studio client says it has been depreciated in favor of ConstraintLayout


GridViewConstraintLayout不是等价的东西,所以推荐没有意义。
GridLayout相当于 ConstraintLayout . GridLayout也是not deprecated .

but is it okay to use GridView for production code?



两个GridViewGridLayout在生产代码中使用是安全的。它们已经过时了,我不建议任何人使用它们,但它们是安全的。
  • 如果您想要的是网格中项目的可滚动容器,您可以使用 GridView , 虽然 RecyclerViewGridLayoutManager会是更好的选择
  • 如果您想要的是网格中项目的不可滚动容器,您可以使用 GridLayout或者也许 TableLayout , 虽然 ConstraintLayout会是更好的选择
  • 关于android - 在 Android 中使用 GridView 是否安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57225567/

    相关文章:

    android - 结构数据库 Firestore 帖子

    android - 多个项目的 GridView 项目列表选择器在 Android 中不起作用

    android - Kotlin Android Firebase 数据库 Hashmap 转换为类

    android - 启动应用程序时获取新短信的更快/最快的方法 - Android

    Android NDK 增量构建

    java - ERROR : In <declare-styleable> NavArgument, 找不到属性类型

    android - 使用 Espresso 测试应用程序时出现 "Native crash"

    android - 将 gridview 项目可检查状态传播给 child

    java - 在 GridView 组件中显示多个图像时,Android 应用程序崩溃

    java - RecyclerView Item Click Listener 的正确方式