Xamarin.Android开发-APP欢迎页面

1.添加Xamarin.Android.Support.v4.dll

2.使用ViewPager控件

3.为ViewPager设置适配器,声明适配器继承PagerAdapter,重写3个方法,1个属性

ViewPager mVP = FindViewById<ViewPager>(Resource.Id.mYvp);
mVP.Adapter = new MyPageAdapter(this);

 

public override int Count
{}

public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
 {}

public override void DestroyItem(ViewGroup container, int position, Java.Lang.Object @object)
{}

public override bool IsViewFromObject(View view, Java.Lang.Object @object)
 {}

4.Java是区分大小写的,所以在控件命名时要使用Android原始的控件命名

<android.support.v4.view.ViewPager  android:id="@+id/mYvp"
    android:layout_width="match_parent"
    android:layout_height="match_parent">   
</android.support.v4.view.ViewPager>

如果android.support.v4.view写成Android.Support.V4.View部署到Android模拟器时会出现Didn't find class "Android.Support.V4.View.ViewPager" on path: DexPathList[[zip file "/data/app/*-1.apk错误

posted @ 2015-05-20 17:04  Rich 申  阅读(608)  评论(0编辑  收藏  举报