My Imageview does not appear on my phone

Asked

Viewed 331 times

0

I created a Layout and an Activity for this Layout.

In Layout I only have an Imageview with a png image that is located in Resources/Drawables.

When I Debug in the App Imageview does not appear on my phone screen.

This is my 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>

This is the code of my Activity:

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

            Intent GoToLogin = new Intent(this, typeof(MainActivity));
            Thread.Sleep(5000);
            this.Finish();
            StartActivity(GoToLogin);
        }
    }
}

If you want me to add more data, say.

Thanks in advance.

I have a copy of this question in Stackoverflow Inglés, if you give me the answer there I will then put it here and vice versa.

2 answers

1


Cheesebaron answered me this at Stack Overflow Inglés, I already have the answer.

namespace *********
{
    [Activity(Label = "xxxxxxxxx", MainLauncher = true, Icon = "@drawable/Logo")]
    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);
        }
    }
}

The problem was I didn’t have time for the image to appear.

0

Remove the line :

 this.Finish();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.