2012-04-25 32 views
1

我需要以類似網格的格式顯示一些數據。爲此,我使用ListView,併爲ListViewROW定義了單獨的XML佈局。Android Spinner在自定義ListView中不完全可見

main.xml中:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/newback" > 

    <TableLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
     <Tablerow> SOME OTHER CONTROLS HERE </Tablerow> 
     <Tablerow> 
      <ListView 
       android:id="@+id/mylistview" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:padding="10dp"> 
      </ListView> 
     </Tablerow> 
    </TableLayout> 
</TableLayout> 

ListViewRow.xml

<TableLayout 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:orientation="vertical" 
    android:weightSum="1"> 

    <TableRow 
     android:id="@+id/tableRow1" 
     android:layout_width="fill_parent" 
     android:layout_height="60dp" 
     android:weightSum="1"> 

     <TextView 
      android:id="@+id/col1" 
      android:layout_width="100dp" 
      android:layout_height="50dp" 
      android:clickable="true" 
      android:padding="5dip" 
      android:gravity="left"/> 

      <TextView android:id="@+id/col2"/> 
      <TextView android:id="@+id/col3"/> 
      <TextView android:id="@+id/col4"/> 

      <Spinner 
       android:id="@+id/cmbOptions" 
       android:layout_width="100dp" 
       android:layout_height="50dp" 
       android:clickable="true" 
       android:padding="5dip" 
       android:gravity="left" 
       android:drawSelectorOnTop="true" 
       android:prompt="@string/optionPrompt"/> 
     android:text="" /> 

     <ImageView 
      android:id="@+id/imagecorrectivedocument" 
      android:layout_width="35dp" 
      android:layout_height="35dp" 
      android:background="@drawable/crane_ins" 
      android:clickable="true"/> 
    </TableRow> 
</TableLayout> 

問題

的問題是,在所得到的網格,微調控制項控件是不完全可見。請參閱屏幕截圖:

Screen shot

我該如何解決這個問題?

回答

3

在XML的微調,請嘗試:

android:layout_gravity="center_vertical" 
+0

謝謝你讓我試試。 – 2012-04-25 16:15:51

+0

偉大的感謝,它爲我工作。你知道我已經花了4個小時在這個問題上?再次感謝!! – 2012-04-25 16:19:20