安卓——implements——OnClickListener

 //实现底部的按钮激活监听 设置不同src

    class  click implements OnClickListener{


        @Override
        public void onClick(View v) {

            switch (v.getId())
            {

                case R.id.bottom_talk:
                    btalk.setImageResource(R.drawable.main_bottom_ico_talk_activite);
                    bfind.setImageResource(R.drawable.main_bottom_ico_find);
                    btalkdir.setImageResource(R.drawable.main_bottom_ico_talkdir);
                    bme.setImageResource(R.drawable.main_bottom_ico_me);

                    break;
                case R.id.bottom_talkdir:
                    btalk.setImageResource(R.drawable.main_bottom_ico_talk);
                    bfind.setImageResource(R.drawable.main_bottom_ico_find);
                    btalkdir.setImageResource(R.drawable.main_bottom_ico_talkdir_activite);
                    bme.setImageResource(R.drawable.main_bottom_ico_me);
                    break;
                case R.id.bottom_find:
                    btalk.setImageResource(R.drawable.main_bottom_ico_talk);
                    bfind.setImageResource(R.drawable.main_bottom_ico_find_activite);
                    btalkdir.setImageResource(R.drawable.main_bottom_ico_talkdir);
                    bme.setImageResource(R.drawable.main_bottom_ico_me);

                    break;
                case  R.id.bottom_me:
                    btalk.setImageResource(R.drawable.main_bottom_ico_talk);
                    bfind.setImageResource(R.drawable.main_bottom_ico_find);
                    btalkdir.setImageResource(R.drawable.main_bottom_ico_talkdir);
                    bme.setImageResource(R.drawable.main_bottom_ico_me_activite);
                    break;

            }
        }
    }
}
posted @ 2018-06-29 02:33  baobaoMaster  阅读(314)  评论(0编辑  收藏  举报