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"> 
相关问题