2012-02-16 21 views
1

tablerowを持っていて、その内部に3つの要素(ImageViews)を持つとします。Androidの要素固定の配置

最初のケースでは、すべて3つの項目に可視性値VISIBLEがあります。要素の可視性をGONEにしていますか。その場合、他の2つのアイテムが一度逃した場所に調整されます。

しかし、私が望むのは、すべてのアイテムを固定した位置にする必要があるということです。したがって、アイテムの可視性をGONE状態にしている場合は、残りの要素も同じ場所にあることになります。

これを達成する手助けができますか?レイアウト内のあらゆるImageView

答えて

0

使用stretchcolumnslayout_spanlayout_columnを指定..

+0

もっと具体的なことができます。あなたは役に立つリンクを提供できます。 –

0
Try this out, 
<?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="fill_parent" 
    android:orientation="vertical" > 


    <TableLayout 
     android:id="@+id/tableLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:stretchColumns="1" > 

     <TableRow 
      android:id="@+id/button" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:background="@drawable/topbg" > 

      <ImageButton 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_column="0" 
       android:layout_span="1" 
       android:src="@drawable/ic_add" /> 

      <ImageButton 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_column="1" 
       android:layout_span="1" 
       android:src="@drawable/ic_add" /> 

      <ImageButton 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_column="2" 
       android:layout_span="1" 
       android:src="@drawable/ic_add" /> 
     </TableRow> 
    </TableLayout> 

</LinearLayout> 
+0

私はあなたが私が何を意味していないと思う。この場合も同じことが起こります。 –

0

、あなたのアイテムと、より多くの柔軟性をしたい場合は、常にあなたが簡単にあなたの問題を解決することを願って、相対的なレイアウトのために行くしてみてください相対レイアウトを使用してアイテムを動的にまたは静的にどちらでも必要なことを行うことができます。

関連する問題