如何快速獲取ListView的打氣筒對象
阿新 • • 發佈:2018-11-22
color rri posit lis item flat 三種 osi viewgroup
簡單的方式有三種:
@Override public View getView(int position, View convertView, ViewGroup parent) { View view; if (convertView == null) { // 獲取打氣筒的三種方式 // 方式一: // view = View.inflate(getApplicationContext(), R.layout.item, null);// 方式二: // view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.item, null); // 方式三: LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.item, null); }else { view = convertView; } return view; }
如何快速獲取ListView的打氣筒對象