basically want search mode on actionbar, other app.
i not sure how other app implemented pictures (maybe listview), make mine gridview. filter use works fine filter items based on name.
for else forgot post let me know , update asap.
grid.xml:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.skypower.myapp.grid"> <searchview android:id="@+id/searchview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_alignright="@+id/gridview" android:layout_marginleft="10dp" android:queryhint="hey"> </searchview> <gridview android:id="@+id/gridview" android:numcolumns="4" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/searchview1" android:layout_alignparentleft="true" > </gridview> </relativelayout>
manifest.xml:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.skypower.myapp"> <application android:allowbackup="true" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /> </activity> <activity android:name="com.skypower.myapp.heroselectionactivity" android:label="hahaha" android:parentactivityname="com.skypower.myapp.mainactivity" > <intent-filter> <action android:name="android.intent.action.search" /> </intent-filter> <meta-data android:name="android.support.parent_activity" android:value="com.skypower.myapp.mainactivity" /> /> </activity> <activity android:name="com.skypower.smartpick.grid" android:label="hahaha" android:parentactivityname="com.skypower.myapp.mainactivity" > <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /> <meta-data android:name="android.support.parent_activity" android:value="com.skypower.myapp.mainactivity" /> </activity> </application> </manifest>
model:xml: (used each grid item)
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="0dp" android:layout_marginright="0dp"/> </relativelayout>
goto searchview widget know inbuilt widget.
Comments
Post a Comment