Navigation Drawer and SearchView theme

319 views Asked by At

For NavigationDrawer I created an activity MASTER (and there are many java files extending Master.java) but there's ExamList.java that extends Master too.

now ExamList has a SearchView...but somehow the themes of Master and ExamsList do not work together (because when ExamList extends ActionBarActivity, then it works fine, but upon extends Master...error occurs)

AndroidManifest (only relevant lines mentioned here):

    <?xml version="1.0" encoding="utf-8"?>

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<android:uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="18" />
<android:uses-permission android:name="android.permission.READ_PHONE_STATE" />
<android:uses-permission
    android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:maxSdkVersion="18" />

<application
    android:allowBackup="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
    <!--android:theme="@android:style/Theme.Holo.Light" >-->


    <activity
        android:name=".SplashScreen"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

            <activity
        android:name=".Exams_List"
        android:label="@string/title_activity_exams__list"
       android:theme="@style/Base.Theme.AppCompat.Light">

        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>

        <meta-data
            android:name="android.app.default_searchable"
            android:resource="@xml/searchable"
            android:value=".SearchResult2" />
    </activity>
    <activity
        android:name=".Custom_List"
        android:label="@string/title_activity_custom__list" >
    </activity>


    <service android:name=".ScheduleService" />
    <service android:name=".NotifyService" />

    <activity
        android:name=".Master"
        android:label="@string/title_activity_master" >
    </activity>
</application>

(the lines where error occurs...) The relevant line in Master.java:

    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

The relevant line in ExamsList.java

    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
1

There are 1 answers

0
Berry Berry On

SearchView have his own theme and its not public. You have a similar question over here. to how change it.