问题描述
我有一个 AutoCompleteTextView
,其中下拉出现的观点,而不是低于上面。有人可以帮我解释一下这个原因?它可以固定在不改变布局的太多了?
I have an AutoCompleteTextView
, which drop-down appears above the view instead of below. Can someone help me and explain the reason of this? Can it be fixed without changing the layout too much?
下面是我的布局其中包括提到的部分 AutoCompleteTextView
:
Here is the part of my layout which includes mentioned AutoCompleteTextView
:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/LinearNewSearch"
android:layout_width="wrap_content"
android:layout_height="60dip"
android:layout_alignParentRight="true"
android:gravity="right"
android:orientation="horizontal" >
<TextView
android:id="@+id/TextView16"
android:layout_width="35dip"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0.0"
android:textColor="#ffa500"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" = "
android:textColor="#00ff00"
android:textSize="17sp"
android:textStyle="bold" />
<EditText
android:id="@+id/EditText17"
android:layout_width="45dip"
android:layout_height="fill_parent"
android:focusable="false"
android:gravity="center"
android:inputType="numberDecimal"
android:text="0.0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" x "
android:textColor="#00ff00"
android:textSize="17sp"
android:textStyle="bold" />
<AutoCompleteTextView
android:id="@+id/NewSearch"
android:layout_width="190dip"
android:layout_height="fill_parent"
android:layout_marginRight="10dip"
android:completionThreshold="1"
android:dropDownHeight="120dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/NewList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/LinearNewSearch"
android:layout_marginRight="5dip"
android:layout_marginTop="-7dip"
android:gravity="top"
android:orientation="horizontal" >
<Button
android:id="@+id/AddNewSearch"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_gravity="center"
android:layout_marginBottom="25dip"
android:layout_marginRight="5px"
android:text="+"
android:textColor="#000080"
android:textSize="15sp"
android:textStyle="bold" />
<VerticalSeekBar
android:id="@+id/seekbar2"
android:layout_width="wrap_content"
android:layout_height="150dip"
android:layout_marginRight="8px"
android:max="10"
android:progress="1" />
<LinearLayout
android:id="@+id/LinearLayout80"
android:layout_width="210dip"
android:layout_height="150dip"
android:layout_marginRight="15dip"
android:background="#25FFFFFF"
android:orientation="vertical" >
<ListView
android:id="@+id/List06"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
我见过的建议添加安卓dropDownHeight =100dp
到 AutoCompleteTextView
声明,但没有帮助。
I've seen a suggestion to add android:dropDownHeight="100dp"
to AutoCompleteTextView
declaration, but that didn't help.
推荐答案
尝试添加 dropDownVerticalOffset 属性来AutoCompleteTextView在你的XML:
Try adding dropDownVerticalOffset attribute to AutoCompleteTextView in your xml:
...
<AutoCompleteTextView
android:id="@+id/NewSearch"
android:layout_width="190dip"
android:layout_height="fill_parent"
...
android:dropDownVerticalOffset="50dp"
...
/>
...
这篇关于AutoCompleteTextView下拉出现上述的编辑字段,而不是下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!