예제 #1
0
 private View getFooterView() {
   if (mFooterView == null) {
     FrameLayout fl = new FrameLayout(getActivity());
     TextView tv = new TextView(getActivity());
     tv.setGravity(Gravity.CENTER);
     tv.setTextColor(0xFFaaaaaa);
     tv.setBackgroundColor(0xFFffffff);
     FrameLayout.LayoutParams params =
         new FrameLayout.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, (int) CommonUtils.dpToPx(getActivity(), 50));
     fl.addView(tv, params);
     mFooterView = fl;
   }
   TextView tv = (TextView) mFooterView.getChildAt(0);
   tv.setText("共有" + SongManager.with(getActivity()).getSongSize() + "首歌");
   return mFooterView;
 }
예제 #2
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   View v = convertView;
   if (v == null) {
     LayoutInflater vi =
         (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     v = vi.inflate(R.layout.row, null);
   }
   Message m = items.get(position);
   // if (m != null) {
   m.createColorFromString(m.from);
   TextView tt = (TextView) v.findViewById(R.id.username);
   TextView bt = (TextView) v.findViewById(R.id.message);
   if (isMonospaced) {
     tt.setTypeface(Typeface.MONOSPACE);
     bt.setTypeface(Typeface.MONOSPACE);
   }
   tt.setText(m.getFrom());
   tt.setTextColor(m.color);
   bt.setText(m.getMessage());
   // }
   return v;
 }