【发布时间】:2016-03-23 03:08:19
【问题描述】:
我希望我的卡片如下所示
我保持这样的布局
<android.support.v7.widget.CardView
android:layout_gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="2dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Order# GAMH2103"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:gravity="start"
android:textSize="15dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Confirmed"
android:drawableRight="@drawable/check"
android:textColor="#00FF00"
android:gravity="end"
android:textSize="15dp"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"
android:layout_marginTop="5dp"
/>
</LinearLayout>
不知何故,我无法让“已确认”的 TextView 可见。我可以看到订单#。
我玩过gravity 和layout_gravity,但不知怎么打不通。
请帮忙。
谢谢,拉克什曼。
【问题讨论】:
-
因为您设置了“order#though”TextView
android:layout_width="match_parent"的宽度,所以“已确认”TextView 不可见。更改为android:layout_width="wrap_content"。如果您希望“已确认”的 TextView 始终可见,可以添加android:layout_weight="1"。
标签: android android-layout android-linearlayout android-cardview