• 大小: 14.12MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-29
  • 语言: Java
  • 标签: xamarin  

资源简介

xamarin android TabLayout+Fragment+ViewPager制作顶部导航栏,原文链接http://blog.csdn.net/kebi007/article/details/70470754

资源截图

代码片段和文件信息

using Android.App;
using Android.Views;
using Android.OS;
using FragmentDemo.Fragments;
using Android.Support.V7.App;
using Android.Support.V4.View;
using Android.Support.Design.Widget;
namespace FragmentDemo
{
    [Activity(Label = “FragmentDemo“ MainLauncher = true Icon = “@drawable/icon“ Theme = “@style/AppTheme“)]
    public class MainActivity : AppCompatActivity
    {
        //UI objects
        private ViewPager viewPager;
        private MyFragmentPagerAdapter mAdapter;
        //页面的常量
        public const int PAGE_ONE = 0;
        public const int PAGE_TWO = 1;
        public const int PAGE_THREE = 2;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

 
            if (Build.VERSION.SdkInt >= Build.VERSION_CODES.Kitkat)
            {
                //透明状态栏  
                Window.AddFlags(WindowManagerFlags.TranslucentStatus);
                //透明导航栏  
                Window.AddFlags(WindowManagerFlags.TranslucentNavigation);
            }
            viewPager = FindViewById(Resource.Id.ly_content);
            TabLayout tab = FindViewById(Resource.Id.tabMain);
            mAdapter = new MyFragmentPagerAdapter(SupportFragmentManagertab.TabCount);
            for (int i = 0; i < mAdapter.Count; i++)
            {
                tab.AddTab(tab.NewTab().SetText(mAdapter.GetPagetitle(i)));
            }
            tab.TabGravity = TabLayout.ModeScrollable;

            viewPager.Adapter = mAdapter;
           viewPager.CurrentItem=0;
           //txt_chat.Selected = true;
            //Tab 选择事件
            tab.TabSelected += (s e) =>
            {
                viewPager.CurrentItem = e.Tab.Position;
            };
            viewPager.AddOnPageChangeListener(new  TabLayout.TabLayoutOnPageChangeListener(tab));
        }
      }
    }



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        620  2016-11-20 20:03  FragmentDemo\Assets\AboutAssets.txt

     文件      58368  2017-04-21 02:06  FragmentDemo\bin\Debug\FragmentDemo.dll

     文件       2693  2017-04-21 02:06  FragmentDemo\bin\Debug\FragmentDemo.dll.mdb

     文件    6234028  2017-04-21 02:07  FragmentDemo\bin\Debug\FragmentDemo.FragmentDemo-Signed.apk

     文件    6269154  2017-04-21 02:06  FragmentDemo\bin\Debug\FragmentDemo.FragmentDemo.apk

     文件      28160  2017-04-21 02:06  FragmentDemo\bin\Debug\FragmentDemo.pdb

     文件      44745  2017-04-21 02:06  FragmentDemo\bin\Debug\Java.Interop.dll.mdb

     文件    7604642  2017-04-21 02:06  FragmentDemo\bin\Debug\Mono.Android.dll.mdb

     文件    1496781  2017-04-21 02:06  FragmentDemo\bin\Debug\mscorlib.dll.mdb

     文件     137422  2017-04-21 02:06  FragmentDemo\bin\Debug\System.ComponentModel.Composition.dll.mdb

     文件     359097  2017-04-21 02:06  FragmentDemo\bin\Debug\System.Core.dll.mdb

     文件     768028  2017-04-21 02:06  FragmentDemo\bin\Debug\System.dll.mdb

     文件      48067  2017-04-21 02:06  FragmentDemo\bin\Debug\System.Net.Http.dll.mdb

     文件     322073  2017-04-21 02:06  FragmentDemo\bin\Debug\System.Runtime.Serialization.dll.mdb

     文件      89254  2017-04-21 02:06  FragmentDemo\bin\Debug\System.ServiceModel.Internals.dll.mdb

     文件     953244  2017-04-21 02:06  FragmentDemo\bin\Debug\System.xml.dll.mdb

     文件      50083  2017-04-21 02:06  FragmentDemo\bin\Debug\System.xml.Linq.dll.mdb

     文件    1973248  2016-01-19 18:12  FragmentDemo\bin\Debug\Xamarin.Android.Support.v4.dll

     文件     888320  2016-01-19 18:12  FragmentDemo\bin\Debug\Xamarin.Android.Support.v7.AppCompat.dll

     文件       7132  2017-04-24 10:18  FragmentDemo\FragmentDemo.csproj

     文件        338  2017-04-24 10:22  FragmentDemo\FragmentDemo.csproj.user

     文件        909  2017-04-24 11:53  FragmentDemo\Fragments\MyFragment.cs

     文件        160  2016-11-20 20:03  FragmentDemo\GettingStarted.Xamarin

     文件       2003  2017-04-24 11:46  FragmentDemo\MainActivity.cs

     文件        521  2017-04-22 10:52  FragmentDemo\packages.config

     文件        313  2016-11-21 23:55  FragmentDemo\Properties\AndroidManifest.xml

     文件       1094  2016-11-20 20:03  FragmentDemo\Properties\AssemblyInfo.cs

     文件       1736  2016-11-20 20:03  FragmentDemo\Resources\AboutResources.txt

     文件        269  2016-11-20 23:44  FragmentDemo\Resources\drawable\tab_menu_chat.xml

     文件        277  2016-11-20 23:44  FragmentDemo\Resources\drawable\tab_menu_contacts.xml

............此处省略36个文件信息

评论

共有 条评论