当我点击编辑按钮时显示删除按钮的每一行 列表视图
单击按钮列表视图后,如此图像更改
答案 0 :(得分:1)
getView()
源代码,用于在点击编辑时处理删除按钮的可见性。
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
View row = convertView;
TextView playerNameTextView, gameStatusTextView ;
final NotiMyTurn notiItem = this.noti.get(position);
if (row == null)
{
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
}
playerNameTextView = (TextView) row.findViewById(R.id.textview_my_turn_player_name);
gameStatusTextView = (TextView) row.findViewById(R.id.textview_my_turn_game_status);
img_game_play = (ImageView) row.findViewById(R.id.img_my_turn_play);
img_player_delete = (ImageView) row.findViewById(R.id.img_player_delete_button);
img_player_pic = (ImageView) row.findViewById(R.id.img_player_pic_my_turn);
playerNameTextView.setText(notiItem.playerName);
gameStatusTextView.setText(notiItem.gameStatus);
if(editMode)
{
//img_game_play.setVisibility(View.INVISIBLE);
img_player_delete.setVisibility(View.VISIBLE);
img_player_delete.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.fade_in));
img_player_pic.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.move));
playerNameTextView.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.move));
gameStatusTextView.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.move));
img_game_play.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.fade_out));
}
else
{
if(isEditClickedFirst)
{
img_game_play.setVisibility(View.VISIBLE);
img_player_delete.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.fade_out));
img_player_pic.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.move_back));
playerNameTextView.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.move_back));
gameStatusTextView.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.move_back));
img_game_play.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.fade_in));
}
img_player_delete.setVisibility(View.GONE);
}
row.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
Toast.makeText(activity, "Clicked", Toast.LENGTH_SHORT).show();
}
});
return row;
}