我将尝试创建一个卡片视图应用程序,其中卡片视图包含两个文本视图,需要并排放置,但是文本视图重叠了。是否有一种机制可以像 RelativeLayout(layout_below 或 layout_toRightOf)那样放置元素到 Cardviews 中?
我能通过在 RelativeLayout 中添加阴影并使其看起来像 Cardview 来实现此功能,但我想在 Cardview 中实现这一点。
以下是我的布局代码:
目前显示的样式如附图所示:
我能通过在 RelativeLayout 中添加阴影并使其看起来像 Cardview 来实现此功能,但我想在 Cardview 中实现这一点。
以下是我的布局代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@android:color/black"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:background="@color/white"
android:layout_width="200dp"
android:layout_height="200dp">
<TextView
android:id="@+id/info_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Textview one"
android:gravity="center"
android:textSize="36sp" />
<TextView
android:id="@+id/info_text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Textview two"
android:gravity="center"
android:textSize="36sp" />
</android.support.v7.widget.CardView>
</RelativeLayout>
目前显示的样式如附图所示: