0

所以,我目前正在創建我的第一個Android應用程序。這是一場艱難的戰鬥,但我不知何故掛在那裏。現在仍然停留在設計上。Android - 線性/相對佈局,同一行和下一行

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal" > 

<TextView 
    android:id="@+id/phid" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:visibility="gone" /> 

<ImageView 
    android:id="@+id/color" 
    android:contentDescription="paintable circle" 
    android:layout_width="18dp" 
    android:layout_height="fill_parent" 
    android:layout_gravity="left" 
    android:layout_marginLeft="6dip" 
    android:layout_marginTop="6dip" 
    android:src="@drawable/circle" /> 

<TextView 
    android:id="@+id/datetime" 
    android:layout_width="wrap_content" 
    android:layout_height="60dip" 
    android:paddingBottom="6dip" 
    android:paddingLeft="6dip" 
    android:paddingRight="10dp" 
    android:paddingTop="10dip" 
    android:textSize="12sp" 
    android:textStyle="bold" />  

這給出了一個很好的列表,標題左上角,並在最右上方的日期。但是我想要在標題下使用textview,與日期時間相同的字體大小,以及日期時間下具有相同字體大小的另一個textview。我嘗試添加另一個LinearLayout,一個RelativeLayout,沒有任何額外的佈局,但它似乎並沒有工作。我在這裏錯過了什麼?謝謝。

回答

0

你可以使用一個RelativeLayout的

發生在頂部的標題左

android:layout_alignParentLeft = "true" 

地方右邊的日期時間

android:layout_alignParentRight = "true" 

然後爲每個要在TextViews的放置在組件下,使用

android:layout_below = (give the id of the control) 

乾杯

相關問題