Nestor
Nestor

Reputation: 8384

Multiline AutoCompleteTextView not accepting scrolling touch

I created a multiline AutoCompleteTextView component inside an activity whose main root is a scrollview (because my activity contains lots of controls), and set its max and min lines to 4. It loads the text properly, but when I try to scroll inside the AutoCompleteTextView, the whole activity scrolls. Here is the code of the AutoCompleteTextView:

<AutoCompleteTextView  
    android:id="@+id/txtData"
    android:inputType="textMultiLine"  
    android:lines="4" 
    android:minLines="4"
    android:maxLines="4"
    android:gravity="top|left"
    android:textColor="#000000"
    android:layout_below="@id/lblAddress"
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:scrollbars="vertical" 
    android:textSize="16sp"
/>

Any idea what I should set to keep the scroll focus inside the AutoCompleteTextView?

Upvotes: 1

Views: 1117

Answers (1)

LOG_TAG
LOG_TAG

Reputation: 20589

Try to change the dropdown height android:dropDownHeight

This would work when its inside a scrollView and the AutoCompleteTextView is near the top.

To get the focus try this

autoCompleteTextView.setOnFocusChangeListener(new OnFocusChangeListener() {
    public void onFocusChange(View v, boolean hasFocus) {
        if(hasFocus) {
            autoCompleteTextView.showDropDown();
        }
    }
});

Upvotes: 1

Related Questions