Xamarin C#Android <timeout exceeded =“”getting =“”exception =“”details =“”>

时间:2018-06-09 05:54:34

标签: c# android xamarin.android

我正在开发一个Android应用程序,我偶然发现了一个我无法通过的错误。我的所有研究都指向我相信我缺少一些xml元素,但我不知道是什么,所以希望有更多专业知识的人可以指出它。

我正在获得的visual studio中出现错误

Unhandled Exception:

Android.Views.InflateException: <Timeout exceeded getting exception details>

错误来自我的roundbutton.xml文件

    <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
  <solid android:color="#536878" />
  <corners android:bottomRightRadius="25dp"
      android:bottomLeftRadius="25dp"
      android:topRightRadius="25dp"
      android:topLeftRadius="25dp"/>
</shape>

我正在从我的主要活动xml中调用该代码,并且调用上面的代码是:

<ImageButton
    android:src="@mipmap/baseline_settings_white_36"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:id="@+id/settingsButton_zone2"
    android:layout_marginBottom="0.0dp"
    android:background = "@mipmap/roundbutton"/>

那么,有没有人看到我在圆形按钮xml中留下的内容?如果我删除android:background="@mipmap/roundbutton",那么我不再收到错误,我的应用就会运行。

提前致谢。

1 个答案:

答案 0 :(得分:0)

事实证明我最终发现了这个问题。

我最终只是做了一个解决方法,而不是使用xml文件按钮来制作,我打算以编程方式在C#中进行循环。这有效,但后来我最终搞清楚为什么xml文件不起作用。

原来,我把文件放在mipmap / anydpi-v26文件夹中。我的模拟器试图从它的mipmap / xhdpi文件夹中读取,因为它没有存在,我得到了超时。解决方案是将文件从mipmap文件夹中移出,并进入一个不会因设备屏幕大小而改变的文件夹结构。

希望这可以帮助别人走出困境。