search

Home  >  Q&A  >  body text

android - 在RecyclerView布局使用CardView不能match_parent


结果跑到程序里是这样的::

不能定义宽高,不能让它的宽match,怎么回事?

ringa_leeringa_lee2771 days ago684

reply all(4)I'll reply

  • PHPz

    PHPz2017-04-17 17:28:19

    OnCreateViewholder writes:
    Inflater.inflate(r.layout.xxx,container,false).

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:28:19

    Post your adapter and oncreateviewholder code. When you look at inflate, there are 3 parameters.

    reply
    0
  • PHPz

    PHPz2017-04-17 17:28:19

    Check the width setting of your recyclerview

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:28:19

    I have encountered it before, View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.content_item,parent,false); Just change it to bind cardview like this. This is how I solved it. I hope it can be helpful to you. Not helpful
    http://m.blog.csdn.net/article/details?id=51108390

    reply
    0
  • Cancelreply