2012-04-29 10 views
-1

このコードでは間違いがありますが、この方法が正しいかどうか教えてください。レイアウトコードの間違いは何ですか

リストアイテムを読み込むと、リストは画面全体ではなく検索バーまで拡大していきます。アドバイスをお願いします。

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:background="#000044"> 

     <TableRow> 
      <EditText 
       android:id="@+id/txtUserName" 
       android:width="270dp" /> 

      <Button 
       android:id="@+id/Search_button" 
       android:width="50dp" /> 
       /> 
     </TableRow> 

     <TableRow> 
      <ListView 
       android:id="@+id/Service_name_list" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content"/> 
     </TableRow> 

    </TableLayout> 

また、これはすべての画面で有効であるかどうかを教えてください。

答えて

0

変化として以下の二行目:

<TableRow android:layout_span="2"> 
     <ListView 
     android:id="@+id/Service_name_list" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"/> 
    </TableRow> 

変更唯一のものは、Androidである:layout_span = HTMLのCOLSPANに等しい "2"。

+0

動作しませんでした。 – Naruto

0

layout_spanを追加して、1つのセルを2つのセルにまたがるようにします。

<ListView 
    android:id="@+id/Service_name_list" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_span="2"/> 
関連する問題