[英]Only last Customview is showing inside a Tableview
I have successfully created a TableLayout with a TableRow and some TextViews. 我已经成功创建了带有TableRow和一些TextViews的TableLayout。 Like this:
像这样:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="A"
android:padding="3dip" />
<TextView
android:text="B"
android:gravity="right"
android:padding="3dip" />
</TableRow>
</TableLayout>
But, when I make a TableLayout with a TableRow with a Customview, it only shows the last CustomView: 但是,当我使用带有CustomView的TableRow制作TableLayout时,它仅显示最后一个CustomView:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow>
<MyFirstView
android:id="@+id/MyFirstView"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="#fff400" />
<MySecondView
android:id="@+id/MySecondView"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="#0045ff" />
</TableRow>
</TableLayout>
The view works fine in a LinarLayout, is there something im missing? 该视图在LinarLayout中工作正常,是否缺少即时消息?
so we can do 50% percentage by: 因此我们可以通过以下方式完成50%的百分比:
<TableRow>
<MyFirstView
android:id="@+id/MyFirstView"
android:layout_width="0dp"
android:layout_weight=".50"
android:layout_height="match_parent"
android:background="#fff400" />
<MySecondView
android:id="@+id/MySecondView"
android:layout_width="0dp"
android:layout_weight=".50"
android:layout_height="match_parent"
android:background="#0045ff" />
</TableRow>
Good luck ) 祝好运 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.