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


加载布局
android studio setContentView(R.layout.activity_login)
xamarin android SetContentView(Resource.Layout.activity_login)
项目中初始化控件基本写法一样
android studio 初始化控件Button btnGet =(Button)findViewById(R.id.btn_get); 不过现在基本使用ButterKnife ,到现在使用kotlin开发ButterKnife也不用了
xamarin android 初始化控件 Button btnGet = FindViewById(Resource.Id.btn_get);
activity之间跳转方法
Intent mIntent = new Intent(this,typeof(LoginActivity));
StartActivity(mIntent);
在要跳转的界面加入 [Activity(ParentActivity = typeof(MainActivity))]
简单写了一下加载网络图片及请求api接口
加载图片框架还是延续了使用了glide 框架 请求接口使用了RestSharp
加载网络图片
//加载网络图片
Glide.With(this).Load("https://www.cnblogs.com/images/logo_small.gif").Into(ivPhoto);
接口请求

本文探讨了在VS2017环境下创建的Android项目与Android Studio项目的结构相似性,对比了两者控件初始化、界面跳转、网络图片加载和API请求的方法。重点介绍了ButterKnife和Glide框架的使用,以及Xamarin中的相关实践。
1633

被折叠的 条评论
为什么被折叠?



