xamarin android 开发

开始环境vs2017 直接建立android 项目,左边是android studio 的项目目录  右边是vs建立的android 项目目录 结构基本相同,有res对应的Resources文件 android

 

加载布局 git

android studio  setContentView(R.layout.activity_login)api

xamarin android   SetContentView(Resource.Layout.activity_login)网络

项目中初始化控件基本写法同样框架

android studio    初始化控件Button btnGet =(Button)findViewById(R.id.btn_get); 不过如今基本使用ButterKnife ,到如今使用kotlin开发ButterKnife也不用了ide

xamarin android   初始化控件 Button btnGet = FindViewById<Button>(Resource.Id.btn_get);布局

 

activity之间跳转方法 this

Intent mIntent = new Intent(this,typeof(LoginActivity));
StartActivity(mIntent);3d

在要跳转的界面加入  [Activity(ParentActivity = typeof(MainActivity))]blog

简单写了一下加载网络图片及请求api接口

加载图片框架仍是延续了使用了glide 框架 请求接口使用了RestSharp 

加载网络图片 

//加载网络图片
Glide.With(this).Load("https://www.cnblogs.com/images/logo_small.gif").Into(ivPhoto);

 

接口请求

 项目源代码地址  https://gitee.com/freexiaoyu/xamarinDemo  代码压缩包下载

相关文章
相关标签/搜索