Hi i want to search users in my app via SearchView
widget. I want to show suggested users name in a ListView
above a ViewPager
of same XML
layout when SearchWidget
is active.
I used following xml
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/searched_friends_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:visibility="gone"
android:listSelector="@drawable/list_row_selector" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.support.v4.view.ViewPager>
And in code i visibled ListView
to show users.
@Override
public boolean onQueryTextChange(String newText) {
friendListView.setVisibility(View.VISIBLE);
if (TextUtils.isEmpty(newText)) {
friendListView.clearTextFilter();
} else {
friendListView.setFilterText(newText.toString());
}
return true;
}
it doesn't show ListView
but when i add following code
@Override
public boolean onQueryTextChange(String newText) {
friendListView.setVisibility(View.VISIBLE);
viewPager.setVisibility(View.GONE);
if (TextUtils.isEmpty(newText)) {
friendListView.clearTextFilter();
} else {
friendListView.setFilterText(newText.toString());
}
return true;
}
It shows following output
But i want ListView
above ViewPager
. Thanks in advance.