【问题标题】:My Xamarin app crashes when I add a button添加按钮时,我的 Xamarin 应用程序崩溃
【发布时间】:2021-07-28 09:09:09
【问题描述】:

在我添加按钮或进度条之前,我的原生 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>

【问题讨论】:

  • 你检查过输出日志吗,在视图->输出下,崩溃时会显示相同的日志和细节,请分享以更好地理解。

标签: android xamarin webview


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2017-12-22
    • 1970-01-01
    • 2022-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多