How to get ActionBar view?

前端 未结 5 1300
野性不改
野性不改 2020-11-28 11:10

I\'m using the Showcase library to explain my application feature to the user. In some point I need to dim the whole ActionBar to present another

5条回答
  •  不知归路
    2020-11-28 11:50

    I made a little fix on @idunnololz code to support ActionBarSherlock

    private View getActionBarView() {
    
        int actionViewResId = 0;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            actionViewResId = getResources().getIdentifier(
                    "abs__action_bar_container", "id", getPackageName());
        } else {
            actionViewResId = Resources.getSystem().getIdentifier(
                    "action_bar_container", "id", "android");
        }
        if (actionViewResId > 0) {
            return this.findViewById(actionViewResId);
        }
    
        return null;
    }
    

提交回复
热议问题