问题描述
这是我在xml文件中遇到的呈现错误.我认为与support.v7.SearchView
有关的是我的xml:
This is the rendering error I'm getting in my xml file. I think it has something to do with my support.v7.SearchView
below is my xml:
<RelativeLayout
android:id="@+id/layout_ricerca"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/search_border_backgroud"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="20dp">
<android.support.v7.widget.SearchView
android:id="@+id/testo_ricerca"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:queryHint="@string/search_hint"
android:textSize="25sp"
android:layout_marginStart="5dp"
android:iconifiedByDefault="false"/>
<ImageButton
android:id="@+id/tasto_ricerca"
android:background="@color/trans"
android:layout_marginTop="2dp"
android:layout_width="45dp"
android:layout_height="match_parent"
android:layout_marginEnd="3dp"
android:scaleType="centerInside"
android:layout_alignParentEnd="true"
android:src="@drawable/tasto_ricerca"/>
</RelativeLayout>
当我将<android.support.v7.widget.SearchView
更改为<SearchView
时,错误消失了,但这对我来说不是一个好的解决方案,因为我必须更改所有Java代码才能使用SearchView
而不是android.support.v7.widget.SearchView
.
When I change the <android.support.v7.widget.SearchView
to <SearchView
the error disappears, but that's not a good solution for me because I would have to change all my java code to work with the SearchView
instead of the android.support.v7.widget.SearchView
.
有人知道如何解决此问题吗?为什么会发生?我认为我的xml没什么问题.
Does anyone know how to fix this problem ? why does it happen? I don't think there is anything wrong with my xml.
添加了错误的屏幕截图
推荐答案
当您将大量缓存数据存储在Android Studio
中时,这种类型的错误就要来了.
When you have lot of cache memory data are store in Android Studio
that time this type of error is coming..
有很多解决方法.
-
最快的方法是
File
→Invalidate caches / Restart...
→Just Restart
.
右键单击project
和Synchronize ...Project
这篇关于呈现问题无法解析资源@ id/search_edit_frame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!