Android 我的ImageView没有´;不显示在我的设备屏幕上

Android 我的ImageView没有´;不显示在我的设备屏幕上,android,xamarin,Android,Xamarin,我创建了一个布局和该布局的一个活动 在布局中,我只有一个带有png图像的ImageView,它位于参考资料/绘图表中 当我在设备中启动应用程序时,ImageView不会出现在屏幕上 这是我的XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.a

我创建了一个布局和该布局的一个活动

在布局中,我只有一个带有png图像的ImageView,它位于参考资料/绘图表中

当我在设备中启动应用程序时,ImageView不会出现在屏幕上

这是我的XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="25px"
android:minHeight="25px"
android:gravity="center"
android:visibility="visible"
tools:visibility="visible">
<ImageView
    android:layout_width="350.0dp"
    android:layout_height="279.5dp"
    android:id="@+id/OpeningLogo"
    android:layout_gravity="center"
    android:visibility="visible"
    tools:visibility="visible"
    android:src="@drawable/logo"
    android:adjustViewBounds="true" />
</LinearLayout>
如果你想让我多放点东西,告诉我


提前谢谢

问题在于,您正在阻止该活动的UI线程,而实际上它从未按预期显示。UI线程没有时间在屏幕上实际绘制任何内容

相反,您应该做如下操作:

namespace GridSocios
{
    [Activity(Label = "xxxxxxxxx", MainLauncher = true, Icon = "@drawable/Logo", NoHistory = true)]
    public class OpeningActivity : Activity
    {
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Opening);

            await Task.Delay(5000);

            var intent = new Intent(this, typeof(MainActivity));
            StartActivity(intent);
        }
    }
}

还要注意,设置了NoHistory=true标志。这意味着您在离开此活动后无法导航回它。

谢谢!帮助很大。历史也会对未来有所帮助。
namespace GridSocios
{
    [Activity(Label = "xxxxxxxxx", MainLauncher = true, Icon = "@drawable/Logo", NoHistory = true)]
    public class OpeningActivity : Activity
    {
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Opening);

            await Task.Delay(5000);

            var intent = new Intent(this, typeof(MainActivity));
            StartActivity(intent);
        }
    }
}