我该如何设置这个布局?
我想做一个相当复杂的布局。有人可以帮助我,如何做我的layout.xml?
第 1 号是布局(表格、线性等)
第 2 号是我的列表视图,包含一行 list_details.xml
编辑:到目前为止我设法完成了第一部分
<TableLayout android:layout_height="wrap_content" android:layout_width="fill_parent">
<TableRow android:layout_width="wrap_content" android:stretchColumns="0,2" android:layout_marginTop="2sp" android:layout_height="wrap_content" >
<TextView android:id="@+id/homeTeam" android:layout_weight="2" android:paddingRight="4sp"/>
<TextView android:text="Vs" android:layout_weight="0" />
<TextView android:id="@+id/awayTeam" android:layout_weight="2" android:gravity="right" android:paddingLeft="4sp"/>
</TableRow>
</TableLayout>
<ListView android:id="@id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ListView>
编辑:
嗯,我可能没有很好地解释我想做什么。这是我的应用程序的屏幕截图 我当前的布局
我希望各列对齐。到目前为止我正在使用这个xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:stretchColumns="0,4" xmlns:android="http://schemas.android.com/apk/res/android">
<TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:id="@+id/ll_playerHome" android:layout_weight="0.5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12sp"/>
<ImageView android:id="@+id/ll_eventHome" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="@+id/ll_minute" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<ImageView android:id="@+id/ll_eventAway" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="@+id/ll_playerAway" android:layout_weight="0.5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:textSize="12sp"/>
</TableRow>
</TableLayout>
I would like to make a rather complex layout. Can someone help me, as how to do my layout.xml ?
No. 1 is a Layout (Table, Linear etc)
No. 2 is my listview, containing a row of list_details.xml
Edit: so far I managed to do the first part
<TableLayout android:layout_height="wrap_content" android:layout_width="fill_parent">
<TableRow android:layout_width="wrap_content" android:stretchColumns="0,2" android:layout_marginTop="2sp" android:layout_height="wrap_content" >
<TextView android:id="@+id/homeTeam" android:layout_weight="2" android:paddingRight="4sp"/>
<TextView android:text="Vs" android:layout_weight="0" />
<TextView android:id="@+id/awayTeam" android:layout_weight="2" android:gravity="right" android:paddingLeft="4sp"/>
</TableRow>
</TableLayout>
<ListView android:id="@id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ListView>
EDIT:
Well i probably didn't explain well what i want to do. Here is a screenshot of my app
My current layout
I want the columns to align. So far i am using this xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:stretchColumns="0,4" xmlns:android="http://schemas.android.com/apk/res/android">
<TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:id="@+id/ll_playerHome" android:layout_weight="0.5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12sp"/>
<ImageView android:id="@+id/ll_eventHome" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="@+id/ll_minute" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<ImageView android:id="@+id/ll_eventAway" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="@+id/ll_playerAway" android:layout_weight="0.5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:textSize="12sp"/>
</TableRow>
</TableLayout>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能会起作用:
This might do the trick: