2017-03-08 3 views
2

私はこの問題を私自身で解決しようとしましたが、私は解決策に到達できません。 stackoverflowに似たような質問がありますが、答えのどれも私を助けませんでした(Cannot instantiate class android.support.v7.widget.SearchView)。クラスinflatableのエラーandroid.support.v7.widget.SearchView

検索は別のアプリでもうまくいきます。私は別のプロジェクトでそれを実装しようとすると、問題が表示されます。

これは私が得るエラーです。

android.view.InflateException:バイナリXMLファイルのライン#10:バイナリXMLファイルのライン#10:エラー膨らまクラスandroid.support.v7.widget.SearchView

ここでは私の.xmlです。以下で

<android.support.v7.widget.SearchView 
    android:id="@+id/floating_search_view" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    app:iconifiedByDefault="false" 
    app:actionViewClass="android.support.v7.widget.SearchView" 
    /> 

<ListView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/list" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:drawSelectorOnTop="true"/> 

(のLinearLayoutに)

android { 
compileSdkVersion 24 
buildToolsVersion "25.0.0" 
defaultConfig { 
    applicationId "it.uniroma1.android" 
    minSdkVersion 21 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:24.2.1' 
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9' 
testCompile 'junit:junit:4.12' 
compile files('libs/pocketsphinx-android-5prealpha-nolib.jar') 
compile files('libs/YouTubeAndroidPlayerApi.jar') 
compile 'com.android.support:design:24.2.1' 
compile 'com.android.support:support-v4:24.2.1' 
compile 'com.github.arimorty:floatingsearchview:2.0.3' 
} 
+0

私たちの投稿されたコードでは問題と思われます。私は試した。それはうまくいった。 –

答えて

0

がで24.0.2にごbuildToolsVersionを設定して、私のマニフェスト

<activity android:name=".robodex.Robodex" 
     android:label="Robodex" 
     android:launchMode="singleTop" 
     > 
     <intent-filter> 
      <action android:name="android.intent.action.SEARCH" /> 
     </intent-filter> 
     <meta-data android:name="android.app.searchable" 
      android:resource="@xml/searchable"/> 
    </activity> 

そして、ここですべての依存関係の一部であり、あなたのbuild.gradleして参照してください。

関連する問題