Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(position == YOUR_MOVE_POSITION) {
- // here hide ordinary elements, and set the ones you need to be visible
- }
- public View getView(int position, View convertView, ViewGroup parent) {
- final View v;
- if(position == 1) { // here come instructions for 'header' no.1
- v = createViewFromResource(position, convertView, parent, mResource);
- // the widget you want to show in header:
- ImageView yourMoveImage = (ImageView) v.findViewById(R.id.your_move);
- // and here come widgets you don't want to show in headers:
- ImageView otherWidget = (ImageView) v.findViewById(R.id.other_widget);
- // then you set the visibility:
- yourMoveImage.setVisibility(View.VISIBLE); // here is the key
- otherWidget.setVisibility(View.GONE); // it may also be View.INVISIBLE (look up the official docs for details)
- } else {
- if(position == 5){ // here come instructions for 'header' no.1
- v = createViewFromResource(position, convertView, parent, mResource);
- // the widget you want to show in header:
- ImageView theirMoveImage = (ImageView) v.findViewById(R.id.their_move);
- // and here come widgets you don't want to show in headers:
- ImageView otherWidget = (ImageView) v.findViewById(R.id.other_widget);
- // then you set the visibility:
- yourMoveImage.setVisibility(View.VISIBLE); // here is the key
- otherWidget.setVisibility(View.GONE); // it may also be View.INVISIBLE (look up the official docs for details)
- } else {
- // if it is the regular item, just show it as desribed in your XML:
- v = createViewFromResource(position, convertView, parent, mResource);
- }
- }
- return v;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement