onItemClickListenerListViewのメソッドからImageViewをアニメーション化することはできません。ListViewはフラグメント内にあります。誰かが私が何をすべきかを提案できますか?
public class MainFragment extends Fragment {
View view;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sis){
View view = inflater.inflate(R.layout.fragment_layout, container, false);
ListView lv = (ListView)view.findViewById(R.id.listf);
this.view= view;
lv.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id){
ImageView i = (ImageView)view.findViewById(R.id.imgv);
AnimationSet as = new AnimationSet(true);
Animation animation1 = AnimationUtils.loadAnimation(this, R.anim.anim1);
Animation animation2 = AnimationUtils.loadAnimation(this, R.anim.anim2);
as.addAnimation(animation1);
as.addAnimation(animation2);
i.setImageResource(R.drawable.logocpic1);
i.startAnimation(as);
}
}