前言 我们学习任何一个新框架时,肯定都需要学习它的子页面用法,因为子页面是封装公共内容最好的容器. 在Xamarin里子页面为Fragment,翻译过来是片段的意思. Fragment 下面我们来学习Fragment的用法. 首先创建一个类MenuFragment继承Fragment:然后重写他的OnCreateView方法,代码如下: [Activity(Label = "KibaApp")] public class MenuFragment : Fragment { public
Fragment中获取Activity的Context时只需要this.getActivity()即可. 而不是许多人说的this.getActivity().getApplicationContext(),如果用后者传入AlterDialog肯定会报错(android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application). 因为只有ac