我的布局不会正确布局

时间:2011-07-16 01:57:19

标签: android

我有一个不会表现的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 / height时,它只是将图标移动到该空间,如下所示:

larger dimensions means shifted down and right

有关如何使其表现的任何想法?善待 - 我很乐意承认布局让我感到困惑。

2 个答案:

答案 0 :(得分:0)

尝试将stretchColumns =“*”添加到您的tablelayout中,为什么不为您尝试向右移动的图片设置layout_gravity?

答案 1 :(得分:0)

我最后走的是与此相反的路线 - 而不是将可能的各种尺寸的可绘制尺寸扩展到我想要的布局,我自己去了图像并将它们缩放到我想要的位置。 然后我可以使用“wrap_parent”或其他任何东西而不必缩放图像。似乎很难走 因为我可能想要在另一台设备上使用更大或更小的抽屉。但是指定大小的东西是最终的

相关问题