Xamarin 练习中与AS不一样的地方

来源:互联网 发布:tensorflow电力 编辑:程序博客网 时间:2024/06/03 18:55

1.自定义控件的时候,继承父View的三个方法,写法不一样:

public class ObservableScrollView : ScrollView    {        private OnOberservableScrollViewListener mlistener;        public ObservableScrollView(Context ct) : base(ct) { }        public ObservableScrollView(Context context, IAttributeSet attributeSet) : base(context, attributeSet) { }        public ObservableScrollView(Context context, IAttributeSet attributeSet, int defaultStyle) : base(context, attributeSet, defaultStyle) { }        }

2.使用自定义View的时候。AS中是包名/类名
Xamarin.Android 中是项目名/文件(可略)/类名
如图

3.使用include 来引用一个标签还是可以用的

 <include layout="@layout/include_header_itl" />

4.改变Activity的Theme

  • 方法一:Theme = “@android:style/Theme.NoTitleBar.Fullscreen”

  • 方法二:

this.SetTheme(Android.Resource.Style.ThemeNoTitleBarFullScreen);//全屏并且无标题栏,必须在OnCreate前面设置。 //this.Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);//只设置本页全屏//this.RequestWindowFeature(WindowFeatures.NoTitle);//只设置无标题栏
  • 方法三:在application结点中修改:
android:theme="@android:style/Theme.NoTitleBar"Theme.Light.NotitleBarandroid:theme="@android:style/Theme.NoTitleBar.Fullscreen"

5.动画监听
animator.AnimationEnd += Animator_AnimationEnd;

   private void Animator_AnimationEnd(object sender, EventArgs e)        {            //TODO...        }
0 0
原创粉丝点击