当前位置: 首页>>代码示例>>Java>>正文


Java StateListDrawable类代码示例

本文整理汇总了Java中org.holoeverywhere.drawable.StateListDrawable的典型用法代码示例。如果您正苦于以下问题:Java StateListDrawable类的具体用法?Java StateListDrawable怎么用?Java StateListDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StateListDrawable类属于org.holoeverywhere.drawable包,在下文中一共展示了StateListDrawable类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PopupWindow

import org.holoeverywhere.drawable.StateListDrawable; //导入依赖的package包/类
public PopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    mContext = context;
    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PopupWindow, defStyleAttr,
            defStyleRes);
    mBackground = DrawableCompat
            .getDrawable(a, R.styleable.PopupWindow_android_popupBackground);
    final int animStyle = a.getResourceId(R.styleable.PopupWindow_android_popupAnimationStyle,
            -1);
    mAnimationStyle = animStyle == R.style.Holo_Animation_PopupWindow ? -1 : animStyle;
    if (mBackground instanceof StateListDrawable) {
        StateListDrawable background = (StateListDrawable) mBackground;
        int aboveAnchorStateIndex = background.getStateDrawableIndex(ABOVE_ANCHOR_STATE_SET);
        int count = background.getStateCount();
        int belowAnchorStateIndex = -1;
        for (int i = 0; i < count; i++) {
            if (i != aboveAnchorStateIndex) {
                belowAnchorStateIndex = i;
                break;
            }
        }
        if (aboveAnchorStateIndex != -1 && belowAnchorStateIndex != -1) {
            mAboveAnchorBackgroundDrawable = background.getStateDrawable(aboveAnchorStateIndex);
            mBelowAnchorBackgroundDrawable = background.getStateDrawable(belowAnchorStateIndex);
        } else {
            mBelowAnchorBackgroundDrawable = null;
            mAboveAnchorBackgroundDrawable = null;
        }
    }
    a.recycle();
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:32,代码来源:PopupWindow.java

示例2: makeBackgroundDrawable

import org.holoeverywhere.drawable.StateListDrawable; //导入依赖的package包/类
private Drawable makeBackgroundDrawable(Line line) {
    StateListDrawable stateListDrawable = new StateListDrawable();
    stateListDrawable.setExitFadeDuration(150);
    stateListDrawable.addState(CHECKED_STATE,
            makeColorDrawable(line.getColorResId()));
    stateListDrawable.addState(View.EMPTY_STATE_SET,
            makeColorDrawable(R.color.translucent_dark_gray));
    return stateListDrawable;
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:10,代码来源:LineSelectorView.java


注:本文中的org.holoeverywhere.drawable.StateListDrawable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。