0

我有AutoCompleteTextView和相對佈局中的不確定進度欄。 現在我遇到的問題是,如果顯示的文本足夠長,它將放置在進度條的背景中。文本顯示在AutoCompleteTextView中的不確定進度欄的背景中

我該如何預防?

這是相關的XML代碼:

<RelativeLayout 
     android:id="@+id/AddressContainer" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toLeftOf="@id/SearchBtn" 

    > 

    <AutoCompleteTextView 
     android:id="@+id/SearchField" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:lines="1" 
     android:singleLine="true" 
     android:layout_marginRight="2dp" 
     android:layout_marginLeft="2dp" 
     android:layout_marginTop="2dp" 
     android:layout_marginBottom="0dp" 
     > 
    </AutoCompleteTextView> 

    <ProgressBar 
     android:id="@+id/progressBar1" 
     style="@style/Widget.ProgressBar.Medium" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:paddingRight="8dp" 
     /> 
</RelativeLayout> 

Link to an image showing the problem

+0

你想做什麼,你可以更具體和粘貼一些代碼,您正在使用的XML文件。 – 2012-04-03 15:55:58

回答

1

試試這個改變使AutoCompleteTextView和ProgressBar`不重疊:

<RelativeLayout 
     android:id="@+id/AddressContainer" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toLeftOf="@id/SearchBtn" 
    > 

    <ProgressBar 
     android:id="@+id/progressBar1" 
     style="@style/Widget.ProgressBar.Medium" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:paddingRight="8dp" 
     /> 

    <AutoCompleteTextView 
     android:id="@+id/SearchField" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_toLeftOf="@id/progressBar1" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:lines="1" 
     android:singleLine="true" 
     android:layout_marginRight="2dp" 
     android:layout_marginLeft="2dp" 
     android:layout_marginTop="2dp" 
     android:layout_marginBottom="0dp" 
     > 
    </AutoCompleteTextView> 


</RelativeLayout> 

編輯:

現在我已經看到了這張照片,如果你想要的文字不是下ProgressBar去簡單地增加一些右填充到您的AutoCompleteTextView像:

android:paddingRight="55dp"> 
相關問題