2013-08-26 6 views
0

Я сделал предложения по поиску в android с помощью edittext и listview.Поиск предложений в Android

То, что мне нужно именно в моей деятельности, есть столько кнопок после edittext, когда я набираю буквы в текстовом редакторе, он будет отображать соответствующий поиск в виде списка, но после этого списка будут появляться кнопки.

мой файл XML выглядит следующим образом ..

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
<!-- Editext for Search --> 
<EditText android:id="@+id/inputSearch" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:hint="Search products.." 
    android:inputType="textVisiblePassword"/> 

<!-- List View --> 
<ListView 
    android:id="@+id/list_view" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 

    <Button android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="after Edit Text"/> 

    <Button android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Second Button"/> 
</LinearLayout> 

я получаю выход в

enter image description here

Ват мне нужно, это мой список suggeations не должны нарушать какие-либо кнопки в фоновом режиме после того, редактируемый текст для поиска, любая помощь будет оценена

+0

Я думаю, что вы ищете, это 'AutoCompleteTextView' .. – bakriOnFire

ответ

0

Измените свой макет на это: переместите кнопки до спискаView

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
<!-- Editext for Search --> 
<EditText android:id="@+id/inputSearch" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:hint="Search products.." 
    android:inputType="textVisiblePassword"/> 

<Button android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="after Edit Text"/> 

    <Button android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Second Button"/> 

<!-- List View --> 
<ListView 
    android:id="@+id/list_view" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 


</LinearLayout> 
Смежные вопросы