上一页 1 ··· 325 326 327 328 329 330 331 332 333 ··· 353 下一页
摘要: editText.addTextChangedListener(new TextWatcher(){public void afterTextChanged(Editable s) {// TODO Auto-generated method stub//s:变化后的所有字符Toast.makeText(getApplicationContext(), "变化:"+s, Toast.LENGTH_SHORT).show();}public void beforeTextChanged(CharSequence s, int start, int count,int afte 阅读全文
posted @ 2014-03-31 15:30 brave-sailor 阅读(837) 评论(0) 推荐(0)
摘要: OK. What I'm trying to achieve is a layout that does the same effect as frozen panes in Excel. That is I want a header row that scrolls horizontally with the main ListView and a left hand ListView that scrolls vertically with the main ListView. The header row and the left hand listview should re 阅读全文
posted @ 2014-03-29 15:15 brave-sailor 阅读(595) 评论(0) 推荐(0)
摘要: 方法四: 添加一个EditText,作为搜索框 + Filter 其实这个不算第四个方法,因为与第二个一样,主要是实现Filter。 但是对于EditText的监听,我以前也没有写过,所以也记录一下。 实现步骤: 1.添加一个EditText,并添加监听事件 ```Java EditText search_tv = (EditText) findViewById(R.id.search_et); search_tv.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequenc 阅读全文
posted @ 2014-03-29 14:52 brave-sailor 阅读(260) 评论(0) 推荐(0)
摘要: 方法三: android:fastScrollEnabled="true"这个很简单,只要把属性设置了,就可以起作用了不过这个滑块比较丑,当然网上也有自定义图片的例子。参考 : http://www.eoeandroid.com/forum.php?mod=viewthread&tid=176342其实就是利用了反射: ```Java try {123456789 Field f = AbsListView.class.getDeclaredField("mFastScroller"); f.setAccessible(true); Object 阅读全文
posted @ 2014-03-29 14:51 brave-sailor 阅读(395) 评论(0) 推荐(0)
摘要: 方法二:android:textFilterEnabled="true" + Filter这个属性在android.widget.AbsListView下,要求adapter必须实现Filterable接口参考: http://justcallmebrian.com/?p=149实现步骤:1.listview布局文件中设置android:textFilterEnabled="true"或代码中listview.setTextFilterEnabled(true);2.adapter实现Filterable接口Filterable接口很简单,就只有一个方法 阅读全文
posted @ 2014-03-29 14:50 brave-sailor 阅读(1815) 评论(0) 推荐(0)
摘要: 方法一: SectionIndexer接口 + 索引列表参考: http://www.apkbus.com/android-69999-1-1.html所谓section 就是一组有共性的item, 比如由相同的字母开头SectionIndexer接口主要的方法有:实现步骤:1.给listview添加section 1 2 3 4 5 6 7 8 91011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 阅读全文
posted @ 2014-03-29 14:48 brave-sailor 阅读(965) 评论(0) 推荐(0)
摘要: packagecom.rytong.mylist;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Random;importandroid.app.Activity;importandroid.content.Context;importandroid.graphics.Color;importandroid.graphics.Rect;importandroid.os.Bundle;importandroid.view.MotionEvent;importandroi 阅读全文
posted @ 2014-03-28 17:27 brave-sailor 阅读(1462) 评论(0) 推荐(0)
摘要: 视图的left , top , right , bottom 的值是针对其父视图的相对位置, 绿色区域是针对其父视图(即黄色区域为(0, 0)点)的坐标,不应该是(115, 170 ) 而是 (55, 55) 阅读全文
posted @ 2014-03-28 16:37 brave-sailor 阅读(195) 评论(0) 推荐(0)
摘要: google 提供的API中,有个类,大家都很熟悉,GestureDetector。使用它,我们可以识别用户通常会用的手势。但是,这个类不支持多点触摸(可能 google认为没有人会在几个手指都在屏幕上的时候,使用手势吧~),不过,最近和朋友们一起做的一个App,的确用到了多点手势(主要是 onScroll和onFling两个手势),所以,我就把这个类拓展了一下,来实现让多个控件各自跟着一跟手指实现拖动和滑动的效果。 顺便说一下,大家应该都知道,在Android3.0以后,Android的触摸事件的分配机制和以前的版本是有区别的。从3.0开始,用户在不同控件上操作产生的touch消息不会相互干 阅读全文
posted @ 2014-03-26 09:50 brave-sailor 阅读(542) 评论(0) 推荐(0)
摘要: 一、结构public final class ViewTreeObserver extends Object java.lang.Object android.view.ViewTreeObserver二、概述 这是一个注册监听视图树的观察者(observer),在视图树种全局事件改变时得到通知。这个全局事件不仅还包括整个树的布局,从绘画过程开始,触摸模式的改变等。ViewTreeObserver不能够被应用程序实例化,因为它是由视图提供,参照getViewTreeObserver()以查看更多信息。三、内部类 interface ViewTreeObserver.OnGl... 阅读全文
posted @ 2014-03-24 10:42 brave-sailor 阅读(265) 评论(0) 推荐(0)
上一页 1 ··· 325 326 327 328 329 330 331 332 333 ··· 353 下一页