Xamairin形式:Android.Views.InflateException:<超时超出了获取异常的详细信息> [英] Xamairin forms : Android.Views.InflateException: <Timeout exceeded getting exception details>
问题描述
对此问题进行了大量研究,发现了同样的问题,但这并不能解决我的问题.所以开始一个新的问题. Xamarin Android:Android.Views.InflateException-加载Layout时出错
Research a lot about this issue and found the same question, which doesn't solve my problem. so starting a new question. Xamarin Android: Android.Views.InflateException - Error when loading Layout
获取 Xamairin表单:Android.Views.InflateException:加载布局时超时超出获取异常详细信息.
Main.axml
Main.axml
<?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:background="#FFCDD2"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/hint_name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="@string/hint_email" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:hint="@string/hint_password" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/btn_signup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btn_sign_up"
android:background="@color/colorPrimary"
android:layout_marginTop="40dp"
android:textColor="@android:color/white" />
</LinearLayout>
我没有在axml中使用layout:width和layout:height属性,仅使用了大小为4kb的图标.
I have not used layout:width and layout:height properties in my axml and only using an icon having 4kb size.
请为此问题提出解决方案,在此先感谢...
Please suggest a solution for this issue, thanks in advance...
推荐答案
获取Xamairin表单:Android.Views.InflateException:加载布局时超出超时时间,无法获取异常详细信息.
Getting Xamairin forms : Android.Views.InflateException: Timeout exceeded getting exception details when loading layout.
在使用TextInputLayout
之前,需要确认两件事:
There are two things needs to be confirmed before using TextInputLayout
:
-
请确保在您的
Xamarin.Android
项目中正确引用了Xamarin.Android.Support.Design
lib.如果您使用的是Xamarin.Forms
,则默认情况下应引用它.
Please make sure,
Xamarin.Android.Support.Design
lib is correctly referenced in yourXamarin.Android
project. If you are usingXamarin.Forms
, it should be referenced by default.
请确保活动的类型为Android.Support.V7.App.AppCompatActivity
.
如果以上方法均无济于事,请提供可以重现该问题的基本演示.
If none of the above things help, please provide a basic demo that can reproduce the problem.
更新:
在对您共享的项目进行测试时.我发现您需要为活动使用Theme.AppCompat
主题,您可以按照以下步骤操作:
Upon testing on the project you shared. I found you need to use a Theme.AppCompat
theme for your activity, you can do that by following below steps:
-
在
Resources\values\
文件夹下使用以下代码创建一个styles.xml
文件:
Create a
styles.xml
file underResources\values\
folder with below codes:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
</resources>
在MainActivity.cs
中定义Activity
属性以像这样利用AppTheme
:
In MainActivity.cs
define the Activity
attribute to leverage AppTheme
like this:
[Activity(Label = "DinexFeedback", MainLauncher = true, Icon = "@drawable/icon",Theme ="@style/AppTheme")]
public class MainActivity : Android.Support.V7.App.AppCompatActivity
{
...
然后该项目将运行正常.
Then the project will run fine.
这篇关于Xamairin形式:Android.Views.InflateException:<超时超出了获取异常的详细信息>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!