0
我有一個Android應用程序,用戶可以喜歡和不同的圖像。我使用recyclerView.I只需禁用按鈕(像/不像)一旦用戶點擊。問題,當我點擊喜歡按鈕,該應用程序轉到主要活動和按鈕等也不會改變不像我做了什麼:像不像按鈕recycler查看圖片
1) layout that holds the each recycler view layout item
2) A view holder for creating each layout
3) A Model Class to holds the data
4) Recycler Adaptor which deals with the data for the Each Layout item
海爾北京時間我的觀點持有者
//Initializing Views
public ViewHolder(View itemView) {
super(itemView);
imageView = (NetworkImageView) itemView.findViewById(R.id.imageViewHero);
textViewName = (TextView) itemView.findViewById(R.id.textViewName);
//textViewPublisher = (TextView) itemView.findViewById(R.id.textViewPublisher);
likeImageView = (ImageView) itemView.findViewById(R.id.likeImageView);
likeImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int id = (int)likeImageView.getTag();
if(id == R.drawable.ic_like){
likeImageView.setTag(R.drawable.ic_liked);
likeImageView.setImageResource(R.drawable.ic_liked);
}else{
likeImageView.setTag(R.drawable.ic_like);
likeImageView.setImageResource(R.drawable.ic_like);
}
}
});