2012-07-18 96 views
0

我需要layout.xml文件大小的幫助。我可能缺少一些基本的東西。我用EditText,SearchButton和ListView創建了一個搜索函數,我將顯示搜索結果。如何在Android中正確修正背景圖片的佈局大小?

每當您點擊EditText時,我需要確保背景圖片在顯示軟鍵盤時不會調整大小,因此我的整個佈局都放置在ScrollView中。這基本上是我使用ScrollView的唯一原因。但滾動型藏漢產生另外一個問題,看看下面的圖片:

http://tinypic.com/view.php?pic=6p3yix&s=6

出於某種原因,我的背景圖片拒絕補全「背景」區域。看看圖片底部是黑色的。因此,當我在大屏幕手機上進行測試時,底部會變黑。我如何設法用我的背景圖填充整個「背景」區域?請幫忙!

編輯:我已經測試過使用layout.xml文件而不使用ScrollView,但由於沒有它,鍵盤會改變背景圖片的大小。我也嘗試在android manifest文件中使用adjustPan,但沒有任何運氣。只有解決方案適用於ScrollView,但現在我得到了背景圖片大小的問題....../Thanx!

我的XML文件:

<?xml version="1.0" encoding="utf-8"?> 

<ScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:id="@+id/sorted_teams_scroll" 
android:isScrollContainer="false"> 

<TableLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/layout_search_task" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center|top" 
     android:orientation="vertical" 
     android:stretchColumns="1" 
     android:weightSum="1.0" 
     android:background="@drawable/orginalbild01" 
     > 

     <TableRow> 

       <TextView 
       android:layout_width="0dip" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.05"> 
      </TextView> 

      <EditText 
       android:id="@+id/search_task_field" 
       android:layout_width="0dip" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.65" 
       android:hint="@string/SearchTaskHint" /> 

      <Button 
       android:id="@+id/search_task_button" 
       android:layout_width="0dip" 
       android:layout_height="fill_parent" 
       android:layout_gravity="center" 
       android:layout_weight="0.25" 
       android:text="@string/Search" /> 

      <TextView 
       android:layout_width="0dip" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.05" > 
      </TextView> 

     </TableRow> 

     <TableRow> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="5dp" > 
      </TextView> 
     </TableRow> 

     <TableRow android:paddingLeft="40dp" > 

      <TextView 
       android:id="@+id/search_task_column_names" 
       android:layout_width="0dip" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.33" 
       android:textStyle="bold" > 
      </TextView> 

      <TextView 
       android:id="@+id/search_task_column_names1" 
       android:layout_width="0dip" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.33" 
       android:textStyle="bold" > 
      </TextView> 

      <TextView 
       android:id="@+id/search_task_column_names2" 
       android:layout_width="0dip" 
       android:layout_height="wrap_content" 
       android:layout_weight="0.33" 
       android:textStyle="bold" > 
      </TextView> 
     </TableRow> 

     <TableRow 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="center"> 

      <ProgressBar 
       android:id="@+id/search_task_progress_bar" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:indeterminateOnly="true" 
       android:visibility="gone" /> 
     </TableRow> 

     <TableRow 
      android:paddingLeft="18dp" 
      android:paddingRight="18dp" 
      > 

      <ListView 

       android:id="@+id/search_task_list" 
       android:layout_width="fill_parent" 
       android:layout_height="355dp" 
       android:gravity="left" /> 
     </TableRow> 
    </TableLayout> 
    </ScrollView> 

回答

1

如果你有問題,只能用鍵盤,然後...

只是嘗試這種禁用時,鍵盤彈出佈局調整 -
在你清單文件將其添加到您的活動中...

android:windowSoftInputMode="adjustPan"

PLS後完整的代碼...在上面的代碼中你設置的背景表格佈局..它將如何申請全面的背景。張貼你的代碼,而無需滾動視圖...