Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Height = 0 in OnSizeChanged method

$
0
0
    protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);
        global::Xamarin.Forms.Forms.Init (this, bundle);
        LoadApplication (new App ());
        SetContentView(Resource.Layout.Main);
        LinearLayout mainLayout = FindViewById<LinearLayout>(Resource.Id.MyLinearLayout);
        var myLayout = new MyLayout(Android.App.Application.Context);
        mainLayout.AddView (MyLayout);
    }



    public class MyLayout : RelativeLayout
    {
        protected override void OnSizeChanged(int w, int h, int oldw, int oldh)
        {
            // w = 800, h = 0
            base.OnSizeChanged(w, h, oldw, oldh);
        }
    }

I want to add my layout on page and change size of my layout when it will be needed.

Width is determined correctly.
But height is always equals 0.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>