1. drawable/actionbar_compat_item.xml

android的selector选择器

 

2.drawable/actionbar_compat_item_pressed.xml

android的selector选择器

 

3.drawable/actionbar_compat_item_focused.xml

android的selector选择器

 

4.

public StateListDrawable setbg(Integer[] mImageIds) {

        StateListDrawable bg = new StateListDrawable();

        Drawable normal = this.getResources().getDrawable(mImageIds[0]);

        Drawable pressed = this.getResources().getDrawable(mImageIds[1]);

        Drawable focused = this.getResources().getDrawable(mImageIds[2]);
bg.addState(View.EMPTY_STATE_SET, normal);
bg.addState(view.PRESSED_ENABLED_STATE_SET,pressed);
   bg.addState(View.FOCUSED_STATE_SET, focused);

return bg; }

 

 

相关文章:

  • 2022-01-21
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2021-06-20
  • 2021-10-05
猜你喜欢
  • 2021-10-12
  • 2022-12-23
  • 2021-07-13
  • 2021-12-17
  • 2022-12-23
  • 2021-04-06
相关资源
相似解决方案