标签:
1
2
3
|
LayoutInflater lif = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View headerView = lif.inflate(R.layout.header, null ); mListView.addHeaderView(headerView); |
1
|
lif.inflate(R.layout.header, mListView, false ); |
1
|
void onItemClick(AdapterView<?> parent, View view, int position, long id) |
1
2
3
4
5
6
7
8
|
final headerCount = 1 ; mListView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Item item = myAdapter.getItem(position - headerCount); } }); |
1
2
3
4
5
6
7
|
mListView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Item item = parent.getAdapter().getItem(position); } }); |
1
|
View inflate( int resource, ViewGroup root, boolean attachToRoot) |
1
2
3
|
View view = mLayoutInflater.inflate(R.layout.header, new ListView(mContext), false ); View view = mLayoutInflater.inflate(R.layout.header, new LinearLayout(mContext), false ); View view = mLayoutInflater.inflate(R.layout.header, new RelativeLayout(mContext), false ); |
原 [Android]LIstView的HeaderView
标签:
原文地址:http://www.cnblogs.com/xgjblog/p/4290032.html