public class NEW_PeopleMain extends Fragment{
private ListView PeopleList , PeopleHeaderList; private View Header; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.new_peoplemain, null); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); init(); } public void init(){ String str[] = { "line1","line2","line3","line4","line5", "line6","line7","line8","line9","line10"};
ArrayAdapter<string> adapter = new ArrayAdapter<string>(getActivity() , android.R.layout.simple_list_item_1 , str);
Header = LayoutInflater.from(getActivity()).inflate(R.layout.new_peopleheader, null); PeopleList = (ListView)getActivity().findViewById(R.id.people_list); PeopleHeaderList = (ListView)Header.findViewById(R.id.people_hlist2);
PeopleList.addHeaderView(Header); PeopleList.setAdapter(adapter); PeopleHeaderList.setAdapter(adapter); PeopleHeaderList.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { PeopleHeaderList.requestDisallowInterceptTouchEvent(true); return false; } });
} } </string></string> |