2011-07-16 137 views
0

我不會表現一個TableLayout,我不知道我做錯了或者沒有做對我的佈局不正確的佈局

my person icon I want much larger

這是我的佈局文件

<TableLayout 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/wall_paper" 

xmlns:android="http://schemas.android.com/apk/res/android"> 
    <TableRow 
    android:layout_weight="1" 
    android:paddingTop="25dp"> 
    <LinearLayout 
    android:orientation="horizontal"> 
    <TextView android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/name" 
     android:textColor="@color/nb_text" 
     android:layout_marginLeft="20dip"/> 
    <EditText android:id="@+id/name" 
     android:layout_width="150dp" 
     android:layout_height="wrap_content" /> 
    </LinearLayout> 
</TableRow> 

<TableRow android:layout_weight="1"> 
    <LinearLayout 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:orientation="horizontal"> 
    <Button android:id="@+id/chgPhoto" 
     android:text="@string/newphoto" 
     android:background="@drawable/camera" 
     android:layout_height="40dp" 
     android:layout_width="60dp" 
     android:layout_marginLeft="20dip" 
     android:layout_gravity="left" 
     android:gravity="left"   ></Button> 
    <ImageView 
     android:id="@+id/StuPhoto" 
     android:src="@drawable/person_icon" 
     android:layout_width="100dip" 
     android:layout_height="80dp" 
     android:layout_marginLeft="25dip" ></ImageView> 
    </LinearLayout> 
</TableRow> 

</TableLayout> 

我想要的人圖標,並導致照片要大得多,並轉移到更遠的權利,但沒有我這樣做似乎幫助。事實上,當我增加了照片的layout_width /高度,它只是將這個圖標,等,使得空間:

larger dimensions means shifted down and right

如何使這種行爲的任何想法?善良 - 我承認佈局讓我感到困惑。

回答

0

嘗試在您的tablelayout中添加stretchColumns =「*」,爲什麼不爲您嘗試移動到右側的圖片設置layout_gravity?

0

我最終走了與此相反的路線 - 而不是按照我想要的佈局縮放drawables,這可能是各種大小,我自己去圖像,並縮放到我想要的。 然後,我可以使用「wrap_parent」或其他什麼,而不必縮放圖像。似乎很難去 ,因爲我可能想在另一臺設備上的更大或更小的drawable。但指定大小頂點的東西到最後沒有盡頭