SideBar textColor = 0xFFA6A9AA backgroundColor = 0x55DDDDDD backgroundActionDownColor = 0xFFCCCCCC isDown = SideBar(Context context, AttributeSet attrs, [] l = [0 SectionIndexer sectionIndexter = m_nItemHeight = 29 selectIndex = -1 == onMeasure( widthMeasureSpec, .textSize = height = width =.selfHeight =.selfWidth == selfHeight / newWidth = MeasureSpec.makeMeasureSpec(() .textSize + 5 i = ( idx = i / (idx >== l.length - 1 (idx < 0= 0 (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == (sectionIndexter == = position = (position == -1 .selectIndex == (event.getAction() === .selectIndex = -1 "DrawAllocation" = = textHeight = () (Math.ceil(fm.descent - fm.ascent) + 2 widthCenter = getMeasuredWidth() / 2= = = RectF(0, 0= RectF(0, 015, 15 ( i = 0; i < l.length; i++ (selectIndex === 0xffccffcc= RectF(0, i * m_nItemHeight, getWidth(), m_nItemHeight + i *15, 15 (selectIndex == l.length - 1= 0xffccffcc= RectF(0, l.length *15, 15
float offsetY=((i)*m_nItemHeight)+((m_nItemHeight-textHeight)/2+textHeight-8);//字型縱向置中,20130530修正更新
canvas.drawText(String.valueOf(l[i]), widthCenter, offsetY, paint);
setSections(.l =
<String> indexs = ArrayList<String> addIndex( indexAt( String get(
MyAdapter BaseAdapter ArrayList<String> MyAdapter(Context _context, ArrayList<String>===""= c = frist.charAt(0=(!+=0 Object getItem( getItemId( 0 View getView(== (View) inflate.inflate(R.layout.listview_row, == currentF=stringArray.get(position).charAt(0(position==0""+ oldF=stringArray.get(position-1).charAt(0(!(""+currentF).equalsIgnoreCase((""+""+"" getPositionForSection( position=indexs.indexAt(( getSectionForPosition( 0
MainActivity ==<String> stringList == MyAdapter( ArrayList<String><String> stringList = ArrayList<String>"asdf""anbcd""bdcd""bfefasf""bcadaf""csdafad""dfdaf""edfdfd""fsdfadfasfd""fadsfasdf""fweff""fhghdfgh""gasdfasdfsa""gadfawe""haof""hjooiuoiuio""iasdfasdfas""zero""zoo""zeus""zebra""zest""zing"