android implement dropdown with SearchView in activity -
in activity use searchview , want implement dropdown when result occurred possible ?? in adavance.
searchactivity.java code
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.search_activity); issearchvisible = false; ishomevisible = true; mactivity = this; mcontext = getapplicationcontext(); msearchview = (searchview) findviewbyid(r.id.m_searchview); edtfromdate = (edittext) findviewbyid(r.id.edt_from_date); edtenddate = (edittext) findviewbyid(r.id.edt_end_date); btnsearchnow = (button) findviewbyid(r.id.btn_search_now); int searchplateid = msearchview.getcontext().getresources() .getidentifier("android:id/search_plate", null, null); view searchplateview = msearchview.findviewbyid(searchplateid); if (searchplateview != null) { searchplateview.setbackgroundcolor(color.white); } }
search_activity.xml code
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:background="@color/main_background" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_margin="@dimen/activity_horizontal_margin"> <searchview android:id="@+id/m_searchview" android:layout_width="match_parent" android:layout_height="wrap_content" android:closeicon="@drawable/close" android:searchicon="@drawable/search_blue" android:padding="2dp" android:background="@drawable/editext_background" android:layout_marginbottom="@dimen/activity_horizontal_margin"/> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/title_from_date" android:textsize="20sp" android:textcolor="@color/coloraccent" android:layout_marginbottom="15dp"/> <edittext android:id="@+id/edt_from_date" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputtype="text" android:drawableright="@drawable/calendar" android:paddingright="20dp" android:enabled="false" style="@style/loginedittextview"/> </linearlayout> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/title_end_date" android:textsize="20sp" android:textcolor="@color/coloraccent" android:layout_marginbottom="15dp"/> <edittext android:id="@+id/edt_end_date" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputtype="text" android:drawableright="@drawable/calendar" android:paddingright="20dp" android:enabled="false" style="@style/loginedittextview"/> </linearlayout> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content"> <button android:id="@+id/btn_search_now" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:background="@drawable/search_now"/> </relativelayout> </linearlayout> </linearlayout>
here's manifest code manifest app
<activity android:name=".activity.searchactivity" android:label="@string/title_search_activity" android:configchanges="orientation"></activity>
Comments
Post a Comment