xamarin android——数据绑定到控件(三)
如果当前活动中,只存在一个listview视图,可以借助ListActivity快速的实现一个列表,即当前Activity继承ListActivity.在OnCreate方法中简单的两行代码,就可以创建一个用户列表。
string[] items = new string[]{
"列表 1","列表 2","列表 3","列表 4","列表 5","列表 6","列表 7","列表 8"
}; this.ListAdapter = new ArrayAdapter<string> (this,Android.Resource.Layout.SimpleListItem1,items);
通过ListActivity,可以不调用SetContentView 方法,就可以创建一个简单的列表。要实现更复杂的显示,可以通过自定义显示布局和SimpleAdapter实现。列表的每个子项的布局通过 Android.Resource.Layout.SimpleListItem1 。系统提供了几个简单的布局样式。
每个布局的详细介绍 参考http://developer.android.com/reference/android/R.layout.html#simple_list_item_activated_1
添加ListView的点击事件,只需重写OnListItemClick方法即可
protected override void OnListItemClick (ListView l, View v, int position, long id)
{
Toast.MakeText (this,"click",ToastLength.Long).Show();
}
xamarin android——数据绑定到控件(三)的更多相关文章
- xamarin android——数据绑定到控件(二)
本示例为通过媒体内容提供器获取本机中的图片显示在Gallery中. 活动中简单的初始化代码 private void InitGallery() { Gallery gallery = FindVie ...
- xamarin android——数据绑定到控件(四)
本文为通过自定义列表适配器定义ListView,以上文为基础,基于ListActivity. 定义列表项布局,包含一个图片显示,标题和描述 <LinearLayout xmlns:android ...
- xamarin android——数据绑定到控件(一)
mono for android 中光标由ICursor 接口标识,该接口公开了操作结果数据集的所有方法.光标的使用非常消耗系统资源,所以不使用时应该光比光标.可以通过StartManagingCur ...
- 安卓控件 仪表盘控件 柱状图控件 曲线控件 xamarin.android 分类器 瓶子控件 报警控件 水箱控件 进度条控件等
本篇博客主要介绍一个控件库,HslControls.dll 的界面,这个控件库支持winform,winform的参考另一篇文章:https://www.cnblogs.com/dathlin/p/1 ...
- Android自定义属性、控件三步法
第二步中layout-activity_main.xml 中自命名控件: xmlns:android="http://schemas.android.com/apk/res/android& ...
- Xamarin.android 重写axml控件
https://www.cnblogs.com/lonelyxmas/p/5632694.html <Laco: 用来用引指定的控件 android:layout_widt ...
- Xamarin.Android DatePickerFragment 日期控件
MainActivity 代码: public class MainActivity : Activity { TextView _dateDisplay; Button _dateSelectBut ...
- xamarin.android 给View控件 添加数字提醒效果-BadgeView
本文代码从java项目移植到.net项目 java开源项目:https://github.com/jgilfelt/android-viewbadger using System; using S ...
- 介绍三个Android支持库控件:TabLayout+ViewPager+RecyclerView
本文主要介绍如下三个Android支持库控件的配合使用: TabLayout:android.support.design.widget.TabLayout ViewPager:android.sup ...
随机推荐
- Android - 软件自动更新的实现
转自:http://blog.csdn.net/wwj_748/article/details/8195565 接触到一个很实用的技术,那就是软件自动更新.一般开发者是通过自行在应用平台添加更新版本的 ...
- [Javascript] Manipulate the DOM with the classList API
Learn how to add, remove and test for CSS classes using the classList API. It's more powerful than u ...
- [WebGL] Setting Up WebGL
In this lesson we cover setting up WebGL for use, including creating a canvas, getting the WebGL ren ...
- [MODx] 3. Working with chunks, TV, Category
1. Add chunk: For example, replace the header by using chunk. Usage: [[$chunk_name]] Cut all the hea ...
- 关于port的关闭——Linux
本文出自:http://blog.csdn.net/svitter 引文出自:http://bbs.chinaunix.net/thread-775649-1-1.html 1.关闭服务 servic ...
- quickstack is a tool to take call stack
https://github.com/yoshinorim/quickstack quickstack is a tool to take call stack traces with minimal ...
- 强烈推荐240多个jQuery插件提供下载
jQuery 是继 prototype 之后又一个优秀的 Javascript 框架.其宗旨是—写更少的代码,做更多的事情.它是轻量级的 js 库(压缩后只有21k) ,这是其它的 js 库所不及 的 ...
- Understanding Design And Development Job Titles--reference
If you’re confused about the difference between a front-end developer and a web designer, you’re not ...
- cocos2d-x动作原理
首先CCAction是所有动作的基类,如下图继承关系: 那么来看看CCAction的定义: class CC_DLL CCAction : public CCObject { public: CCAc ...
- Javascript与Ajax
不使用jquery来处理ajax请求该怎么做? 首先要明确html中的某些数据需要从服务端获得,也就是客户端向服务端请求(request)数据,服务端就响应(response)这个请求,把客户端要的数 ...