【发布时间】:2015-08-05 00:07:42
【问题描述】:
我在表格布局中有 2 个卡片视图。 代码:
<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:layout_centerInParent="true"
android:layout_below="@+id/card_view3"
android:layout_marginTop="7dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp">
<TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
<android.support.v7.widget.CardView
android:layout_margin="5dp" android:layout_weight="1"
android:layout_height="180dp" android:layout_width="fill_parent"
android:background="#ffdbff3d">
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_margin="5dp" android:layout_weight="1"
android:layout_height="180dp" android:layout_width="fill_parent"
android:background="#ffdbff3d">
</android.support.v7.widget.CardView>
</TableRow>
</TableLayout>
在 cv1 中有一张图片,问题是当我将图片(在 cv1 中)宽度设置为 fill_parent 时,图片占据了所有行并且不会只填充 cv1,即使我没有设置填充父级,它也能完成它的工作!
我什至无法为我的简历设置背景,我也不知道为什么。
希望你能解决。
【问题讨论】:
-
不要使用表格布局——只是一个建议
-
那我可以用什么代替? @ViktorYakunin
-
如果你要问一个问题,请至少格式化你的代码。
标签: android tablelayout