为什么margin属性在recyclerview行布局中不起作用?

时间:2017-01-16 10:12:15

标签: android android-recyclerview

我有一个Recyclerview视图的两个xml布局。我正在使用LinearLayoutManager。

XML1:

<android.support.v7.widget.CardView
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_margin="5dp">

     <...ChildViews...>

</android.support.v7.widget.CardView>

XML2

<FrameLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content">

   <android.support.v7.widget.CardView
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_margin="5dp">

       <...ChildViews...>

   </android.support.v7.widget.CardView>

</FrameLayout>  

如果我给xml1充气,那么没有保证金。但是在xml2的通货膨胀时,则会产生保证金。是什么原因?

0 个答案:

没有答案