微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

添加按钮时,我的 Xamarin 应用程序崩溃

如何解决添加按钮时,我的 Xamarin 应用程序崩溃

在我添加按钮或进度条之前,我的原生 Xamarin WebView 应用程序运行良好。如果我取消注释下面代码中的一个控件,应用程序会在启动时崩溃。我做错了什么?

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

    <!--
    <Button
        android:layout_weight="34" 
        android:layout_width="0dip"
        android:layout_height="wrap_content" 
        android:orientation="vertical"
        android:text="Home"
        android:id="@+id/btnHome" />
    -->

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/relativeLayout1">
        <!--<ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:visibility="invisible"
            android:id="@+id/progressBar1" />-->

        <android.webkit.WebView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/webView1" />
    </RelativeLayout>

</LinearLayout>

解决方法

好吧,我所做的只是从头开始创建一个新项目并复制我的所有代码,它运行良好。所以,在我的依赖中的某个地方,我把一些事情搞砸了,我猜。但这适用于新项目。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。