public void onPageSelected(int arg0) {
int currentItem = viewPager.getCurrentItem();
resetImg();
switch (currentItem) {
case 0:
imgHome.setImageResource(R.drawable.home_pressed);
break;
case 1:
imgMessage.setImageResource(R.drawable.message_pressed);
break;
case 2:
imgAdd.setImageResource(R.drawable.add_pressed);
break;
case 3:
imgFind.setImageResource(R.drawable.find_pressed);
break;
case 4:
imgSettings.setImageResource(R.drawable.settings_pressed);
break;
default:
break;
}
}
//
public void onClick(View v) {
resetImg();
switch (v.getId()) {
case R.id.id_tab_home:
viewPager.setCurrentItem(0);
imgHome.setImageResource(R.drawable.home_pressed);
break;
case R.id.id_tab_message:
viewPager.setCurrentItem(1);
imgMessage.setImageResource(R.drawable.message_pressed);
break;
case R.id.id_tab_add:
viewPager.setCurrentItem(2);
imgAdd.setImageResource(R.drawable.add_pressed);
break;
case R.id.id_tab_finds:
viewPager.setCurrentItem(3);
imgFind.setImageResource(R.drawable.find_pressed);
break;
case R.id.id_tab_settings:
viewPager.setCurrentItem(4);
imgSettings.setImageResource(R.drawable.settings_pressed);
break;
default:
break;
}
}