开发者

How can i setup this layout?

开发者 https://www.devze.com 2023-04-09 01:29 出处:网络
I would like to make a rather complex layout. Can someone help me, as how to do my layout.xml ? Layout image

I would like to make a rather complex layout. Can someone help me, as how to do my layout.xml ?

Layout image

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"?> 
开发者_JAVA百科<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>


This might do the trick:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:id="@+id/linearLayout1">
        <TextView android:layout_width="wrap_content" android:text="TextView"
            android:id="@+id/textView1" android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_height="wrap_content" android:layout_weight="1"
            android:gravity="center_horizontal"></TextView>
        <TextView android:text="TextView" android:id="@+id/textView2"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:gravity="center_horizontal"></TextView>
        <TextView android:layout_width="wrap_content" android:text="TextView"
            android:id="@+id/textView3" android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_height="wrap_content" android:layout_weight="1"
            android:gravity="center_horizontal"></TextView>
    </LinearLayout>
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:id="@+id/linearLayout2">
        <ListView android:layout_height="wrap_content" android:id="@+id/listView1"
            android:layout_weight="1" android:layout_width="fill_parent"></ListView>
        <TextView android:text="TextView" android:id="@+id/textView2"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:gravity="center_horizontal"></TextView>
        <ListView android:layout_height="wrap_content" android:id="@+id/listView1"
            android:layout_weight="1" android:layout_width="fill_parent"></ListView>
    </LinearLayout>
</LinearLayout>
0

精彩评论

暂无评论...
验证码 换一张
取 消