我想了解卡view.I写了一个简单的代码来查看两张cards.But问题是,第二张卡是不可见的。我认为第一张卡是符合第二张牌,这就是为什么第二张牌不可见。卡在android中相互叠加
我已经在第二张牌中使用了android:layout_marginTop="40dp"
来保持两张牌之间的差距。但是,也只有第一张牌是可见的。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
>
<!-- A CardView that contains a TextView -->
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="200dp"
android:layout_height="200dp"
card_view:cardCornerRadius="30dp"
android:foregroundGravity="center"
android:layout_gravity="center_vertical"
android:paddingTop="10dp"
android:layout_marginLeft="80dp"
android:layout_marginBottom="20dp"
>
<TextView
android:id="@+id/info_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Encrypt Mode"
android:textSize="20dp"
android:textAllCaps="true"
android:gravity="center"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view2"
android:layout_width="200dp"
android:layout_height="200dp"
android:paddingTop="30dp"
card_view:cardCornerRadius="30dp"
android:foregroundGravity="center"
android:layout_gravity="center_vertical"
android:layout_marginLeft="80dp"
android:layout_marginTop="40dp"
>
<TextView
android:id="@+id/info_text2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Decrypt Mode"
android:textSize="20dp"
android:textAllCaps="true"
android:gravity="center"
/>
</android.support.v7.widget.CardView>
如何使这两个卡可见?
你使用什么样的LinearLayout方向? =)也许在这个问题?尝试使用android:orientation =“vertical” –