无法在xml中添加SearchView

问题描述:

我想在layout文件中添加searchview,但它会显示一些错误。我无法弄清楚什么是错的。我的API级别14无法在xml中添加SearchView

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="horizontal" > 


<TextView 
    android:id="@+id/textView" 
    android:layout_width="match_parent" 
    android:layout_height="40dp" 
    android:text="TextView" 
    android:textColor="@color/white" 
    android:textSize="20dp" 
    android:gravity="start" 
    android:paddingLeft="10dp" 
    android:paddingTop="10dp"  /> 
<SearchView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"></SearchView> 

</LinearLayout> 

Error Message

+0

请发布您的包含'SearchView'的布局文件。 – CommonsWare 2015-04-05 12:23:18

+0

也许向我们展示你得到的错误。 – rubengees 2015-04-05 12:45:34

这似乎是在IDE中的错误。 (Android SDK 22 - SearchView rendering problems,SearchView WITHOUT ACTIONBAR

我想你可以放心地忽略这一点,然后等待它被Google修复。