/* (non-Javadoc) * @see android.app.Activity#onKeyDown(int, android.view.KeyEvent) */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK && isSub) { scroll_page_sub.setAnimation(animation_out); scroll_page_sub.startAnimation(animation_out); return true; } return super.onKeyDown(keyCode, event); }
/** * 加载子控件 * * <pre>方法 </pre> * * @param area 地区 */ private void showSubAddressViews(PositionClassify positionClassify) { params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.height = 1; params.leftMargin = 40; if (null != linear_sub && linear_sub.getChildCount() > 0) { linear_sub.removeAllViews(); } if (positionClassify != null) { List<PositionClassify> pList = positionClassify.getSubList(); if (pList != null && pList.size() > 0) { if (!pList.get(0).getCode().equals(positionClassify.getCode())) { PositionClassify pp = new PositionClassify(); pp.setCode(positionClassify.getCode()); pp.setPcode(positionClassify.getPcode()); pp.setHasSub(false); pp.setSubList(null); pp.setValue(positionClassify.getValue()); pList.add(0, pp); } int nn = pList.size(); for (int i = 0; i < nn; i++) { final PositionClassify p = pList.get(i); if (p != null) { final PositionClassItemView itemView = new PositionClassItemView(context); itemView.setPositionClassify(p); itemView.setOnItemClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (p.isHasSub()) { } else { boolean flag = itemView.getCheckedStatus(); itemView.setCheckedStatus(!flag); if (!flag) { code = p.getCode(); value = p.getValue(); startIntent(); finish(); } else { code = ""; value = ""; } } } }); linear_sub.addView(itemView); if (i < nn - 1) { View line = LayoutInflater.from(context).inflate(R.layout.layout_line, null); linear_sub.addView(line, params); } else { params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.height = 1; params.leftMargin = 1; View line = LayoutInflater.from(context).inflate(R.layout.layout_line, null); linear_sub.addView(line, params); } } } scroll_page_sub.setAnimation(animation_in); scroll_page_sub.startAnimation(animation_in); } } }