Adding Dynamic Buttons to different layouts for phone and tablet using RecyclerView with GridLayoutManager

蓝咒 提交于 2019-12-05 18:44:22
Kyoung-june Yi

You can detect screen size with this answer.

If the screen size is Configuration.SCREENLAYOUT_SIZE_LARGE or Configuration.SCREENLAYOUT_SIZE_XLARGE then it maybe a tablet.

  int spanCount = 2;
  if (screenSize == Configuration.SCREENLAYOUT_SIZE_LARGE 
        or screenSize == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
    spanCount = 3;
  }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!