【发布时间】: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>
【问题讨论】:
-
你检查过输出日志吗,在视图->输出下,崩溃时会显示相同的日志和细节,请分享以更好地理解。