@Override public View getView(int position, View convertView, ViewGroup parent) { if (isSectionHeaderPosition(position)) { TextView view; View imgHeader; boolean newFlag = false; if (null == convertView) { convertView = mLayoutInflater.inflate(mSectionResourceId, parent, false); newFlag = true; } else { if (null == convertView.findViewById(mHeaderTextViewResId) || null == convertView.findViewById(mHeaderImageViewResId)) { convertView = mLayoutInflater.inflate(mSectionResourceId, parent, false); newFlag = true; } } view = (TextView) convertView.findViewById(mHeaderTextViewResId); imgHeader = convertView.findViewById(mHeaderImageViewResId); if (newFlag) { ViewUtils.setSize(imgHeader, 53, 53); view.setTextSize(DisplayUtil.textGetSizeSp(context, 28)); ViewUtils.setSize(view, 631, 69); ViewUtils.setMarginRight(view, 12); } view.setText(mSections.get(position).title); imgHeader.setBackgroundResource(R.drawable.icon_time); if (currentTopView == null || currentTopView == convertView) { currentTopView = convertView; imgHeader.setBackgroundResource(R.drawable.icon_time_selected); } return convertView; } else { return mBaseAdapter.getView(sectionedPositionToPosition(position), convertView, parent); } }
private void init(Context context) { builder = new AlertDialog.Builder(context); inflater = LayoutInflater.from(context); view = inflater.inflate(R.layout.recharge_dialog, null); etContent = (EditText) view.findViewById(R.id.et_content); tvCost = (TextView) view.findViewById(R.id.tv_cost_num); rlCostTip = (RelativeLayout) view.findViewById(R.id.rl_cost_tip); btnOK = (Button) view.findViewById(R.id.btn_ok); btnOK.setText("请输入数量"); btnOK.setEnabled(false); etContent.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub if (StringUtils.isEmpty(etContent.getText().toString())) { rlCostTip.setVisibility(View.GONE); btnOK.setText("请输入数量"); btnOK.setEnabled(false); } else { rlCostTip.setVisibility(View.VISIBLE); btnOK.setText("立即支付"); btnOK.setEnabled(true); } tvCost.setText(etContent.getText().toString() + "元"); } }); ViewUtils.setSize(view.findViewById(R.id.rl_content), 564, 426); ViewUtils.setSize(btnOK, 326, 84); ViewUtils.setHeight(view.findViewById(R.id.rl_dialog_top), 88); ViewUtils.setTextSize(view.findViewById(R.id.tv_title), 40); ViewUtils.setSize(view.findViewById(R.id.rl_input), 540, 100); ViewUtils.setMarginRight(view.findViewById(R.id.rl_input), 16); ViewUtils.setMarginBottom(btnOK, 40); ViewUtils.setTextSize(etContent, 34); ViewUtils.setTextSize(tvCost, 28); ViewUtils.setTextSize(view.findViewById(R.id.tv_cost_label), 28); ViewUtils.setTextSize(btnOK, 30); btnOK.setOnClickListener(this); alertDialog = builder.create(); }