您的位置:首頁技術文章
文章詳情頁

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

瀏覽:133日期:2024-09-10 10:19:06

問題描述

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

android - 在RecyclerView布局使用CardView不能match_parent結果跑到程序里是這樣的::

不能定義寬高,不能讓它的寬match,怎么回事?

問題解答

回答1:

OnCreateViewholder里這么寫:Inflater.inflate(r.layout.xxx,container,false).

回答2:

你的adapter,oncreateviewholder代碼貼出來,看inflate的時候參數是3個不

回答3:

看下你的recyclerview的寬度設置

回答4:

之前遇過,View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.content_item,parent,false); 改成這樣綁定cardview就可以了,我是這么解決的,希望對你有沒有幫助http://m.blog.csdn.net/article/details?id=51108390

相關文章:
国产综合久久一区二区三区