第一次使用SearchView就遇到了一個小坑

XLM文件是這樣寫的
<android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/A運行項目編譯可以通過,但是但是后續添加的控件都現實不出來了。baidu。。。。 一圈中文竟然沒有解決方法。
stackoverflow。。。。。啃英文,上面只有一個跟我遇到了相同的問題
眾多答案中只有兩個可行方法
把
<android.support.v7.widget.SearchView替換成
<SearchView看了一下API,這個兩個的區別 

分屬在不同的包下面,v7包的方法有些改動。
在父控件
<android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay">里面添加上一個屬性
android:id="@+id/search_edit_frame"ok,搞定。
新聞熱點
疑難解答