1. 程式人生 > >xamarin.form 判斷不同的終端

xamarin.form 判斷不同的終端

            if(Device.RuntimePlatform == Device.Android)
            {
            }
            else if (Device.RuntimePlatform == Device.iOS)
            {
            }
            else
            {
            }

            switch (Device.RuntimePlatform)
            {
                case Device.Android:
                    this.Padding = new Thickness(0);
                    break;
                case Device.iOS:
                    this.Padding = new Thickness(0, 20, 0, 0);
                    break;
                default:
                    break;
            }

  

其中最常見的是ios終端在app最上面會有20畫素的遮擋,在android裡面預設會有20畫素的間隔,但是ios裡面會和狀態列重疊