当前位置:  编程技术>移动开发
本页文章导读:
    ▪UitableView 滑动条只在滑动时展示        UitableView 滑动条只在滑动时显示 [self.tableView flashScrollIndicators];   ......
    ▪ sencha touch listpaging几时显示no more text        sencha touch listpaging何时显示no more text In the handler, we realise that we've reached the end of the data set when the number of records returned is less than the page size. If the total record count is a multiple of the page size, the last '.........
    ▪ View与SurfaceView 的差别用法       View与SurfaceView 的区别用法 一、View是没有缓存机制的,每次绘图都是重新绘制 如果要实用双缓冲机制的话。 1、自定义一个View 实现onDraw方法 2、调用这个方法,调用刷新onDraw()方法 ssinView.po.........

[1]UitableView 滑动条只在滑动时展示
    来源: 互联网  发布时间: 2014-02-18
UitableView 滑动条只在滑动时显示
[self.tableView flashScrollIndicators];

 


    
[2] sencha touch listpaging几时显示no more text
    来源: 互联网  发布时间: 2014-02-18
sencha touch listpaging何时显示no more text

I've had a similar issue with the ListPaging plugin in SenchaTouch 2, and managed to sort out the 'load more' message behaviour when the end of the data set is reached.

This builds on what John Gordon has come up with (regarding specifying the pageSize andclearOnPageLoad config options), since these properties seem to be the same in Senchatouch 2. I haven't looked at SenchaTouch 1.x in detail. In SenchaTouch 2, all config options must be defined in aconfig property:

Ext.define('MessagingApp.store.MessageThreads', {
    extend  : 'Ext.data.Store',
    requires: ['MessagingApp.model.MessageThread'],

    config:
    {
        model: 'MessagingApp.model.MessageThread',

        autoLoad: false,
        clearOnPageLoad: false,  // This is true by default
        pageSize: 10,            // This needs to be set for paging

        proxy: {
            type: 'jsonp',
            pageParam: 'currentPage',
            limitParam: 'pageSize',
            url: APIURL + '/message-app-service/GetMessageThreads',
            reader: {
                type: 'json',
                rootProperty: 'Data'
            }
        }
    }
});

In the view, where we specify the plugins, we can override the 'load more' and 'no more records' messages:

{
    xtype:'dataview',
    store:'MessageThreads',
    id:'threadList',
    itemTpl:Ext.create('Ext.XTemplate',
        '<!-- template markup goes here -->',
        {
            //custom helper functions here
        }
    ),
    plugins:[
        {
            xclass:'Ext.plugin.ListPaging',
            autoPaging: true,

            // These override the text; use CSS for styling
            loadMoreText: 'Loading...',
            noMoreRecordsText: 'All messages loaded'
        }
    ]
}

The issue is that while our web service returns an array of records for a particular page, there is no overall total count property, which is needed for the plugin to determine when all records have been loaded. Hence as it is, the 'Load more' message will remain (issue #1 in the accepted solution). So in theinit function of our controller, we have to attach an event handler for the load event on the store to hook into when a new page of data is received:

Ext.define('MessagingApp.controller.Messages',
{
    extend: 'Ext.app.Controller',

    config:
    {
        views: [
            'MessageThreads',
            // Other views referenced by this controller
        ],

        stores: [
            'MessageThreads'
        ],

        refs:
        {
            // References to UI elements by selector...
        }
    },

    init: function() {
        // Other internal initialisation...

        this.control(
        {
            // Selector-object pairs...
        });

        // Provide a means to intercept loads of each page of records
        var threadStore = Ext.getStore('MessageThreads');
        threadStore.addBeforeListener('load', this.checkForThreadListEnd, this);
    },

    // Remaining controller functions...

});

In the handler, we realise that we've reached the end of the data set when the number of records returned is less than the page size. If the total record count is a multiple of the page size, the last 'page' will have an empty array. Once the end of the data set has been identified, we update the totalCountconfig property of the store:

checkForThreadListEnd: function(store, records, isSuccessful) {
    var pageSize = store.getPageSize();
    var pageIndex = store.currentPage - 1;    // Page numbers start at 1

    if(isSuccessful && records.length < pageSize)
    {
        //Set count to disable 'loading' message
        var totalRecords = pageIndex * pageSize + records.length;
        store.setTotalCount(totalRecords);
    }
    else
        store.setTotalCount(null);
},

// Other controller functions...

Because this is a 'before' event handler, this property will be crucially updated before the plugin decides whether to display the 'load more' or 'no more records' messages. Unfortunately, the framework doesn't provide a means to hide the 'no more records' message, so this would have to be done via CSS.

Hope this helps.


    
[3] View与SurfaceView 的差别用法
    来源: 互联网  发布时间: 2014-02-18
View与SurfaceView 的区别用法

一、View是没有缓存机制的,每次绘图都是重新绘制

如果要实用双缓冲机制的话。

1、自定义一个View 实现onDraw方法

2、调用这个方法,调用刷新onDraw()方法

	ssinView.postInvalidate();

 

需要格外创建一个Canvas,每次都

3、

	public void onDraw(Canvas canvas){
		
		if(x >= 480){
			x = 0;
			//清空画布
			canvas.drawColor(Color.BLACK); 
			//重新创建一个新的图
			bitmap = Bitmap.createBitmap(480, 104, Config.ARGB_8888);     

		}else{
			//在缓冲中将之前的图绘制好,然后在真正的Canvas上绘制缓冲中的图
			Canvas c = new Canvas();
			c.setBitmap(bitmap);
			int y = (int)(A*Math.sin(x/180.0f*Math.PI));
			System.out.println("==================y:"+y+"===x:"+x);
			c.drawPoint(x, y+A, paint);
			//canvas.save();
			canvas.drawBitmap(bitmap, 0, 0,paint);
			x+=5;
		}
	}

 二、Surface实现了双缓冲技术

提供了一个类SurfaceHolder

1、继承SurfaceView 实现Callback接口(在new SurfaceView的时候会自动回调)

2、刷新SurfaceView

			// TODO Auto-generated method stub
			super.run();
			while(flag == true){
				
				//锁定,获得Canvas
				Canvas canvas = surfaceHolder.lockCanvas(null);
			
				onDraw(canvas);
				//释放锁
				surfaceHolder.unlockCanvasAndPost(canvas);
				
				asinSurfaceView.x += 5;
				
				try {
					Thread.sleep(sleepTime);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		

 

 


    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3