Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
408 views
in Technique[技术] by (71.8m points)

android - Can one use cardview for listview item and how

I would like to implement CardView in my app so that all ListView items are CardViews. Is it as simple as encapsulating a ListView item XML in CardView?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In case someone else come across this question, Other answers are right but then you should place your CardView within FrameLayout and you should make ListView's divider transparent. CardView's elevation and margin attribute won't work unless you use it inside FrameLayout.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...