本文整理汇总了Java中org.holoeverywhere.drawable.DrawableCompat类的典型用法代码示例。如果您正苦于以下问题:Java DrawableCompat类的具体用法?Java DrawableCompat怎么用?Java DrawableCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DrawableCompat类属于org.holoeverywhere.drawable包,在下文中一共展示了DrawableCompat类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LinearLayout
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
public LinearLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.LinearLayout, defStyle, 0);
int index = a.getInt(R.styleable.LinearLayout_android_gravity, -1);
if (index >= 0) {
setGravity(index);
}
setMeasureWithLargestChildEnabled(a.getBoolean(R.styleable.LinearLayout_android_measureWithLargestChild, false));
setDividerDrawable(a.getDrawable(R.styleable.LinearLayout_android_divider));
TypedValue value = new TypedValue();
a.getValue(R.styleable.LinearLayout_android_showDividers, value);
mShowDividers = value.data;
a.getValue(R.styleable.LinearLayout_android_dividerPadding, value);
mDividerPadding = TypedValue.complexToDimensionPixelSize(value.data, context.getResources().getDisplayMetrics());
a.recycle();
mStateOverlay = new DrawableCompat.StateOverlay(this, context, attrs, defStyle);
}
示例2: setStateOnView
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
@SuppressLint("NewApi")
protected final void setStateOnView(View child, boolean value) {
if (child instanceof Checkable) {
((Checkable) child).setChecked(value);
} else if (child instanceof DrawableCompat.StateStub) {
((DrawableCompat.StateStub) child).setActivated(value);
} else if (USE_ACTIVATED) {
child.setActivated(value);
}
}
示例3: PopupWindow
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的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();
}
示例4: setSelector
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
@Override
public void setSelector(int resID) {
setSelector(DrawableCompat.getDrawable(getResources(), resID));
}
示例5: Button
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
public Button(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TextView.construct(this, context, attrs, defStyle);
mStateOverlay = new DrawableCompat.StateOverlay(this, context, attrs, defStyle);
}
示例6: RelativeLayout
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
public RelativeLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mStateOverlay = new DrawableCompat.StateOverlay(this, context, attrs, defStyle);
}
示例7: FrameLayout
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
public FrameLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mStateOverlay = new DrawableCompat.StateOverlay(this, context, attrs, defStyle);
}
示例8: ProgressBar
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
public ProgressBar(Context context, AttributeSet attrs, int defStyle,
int styleRes) {
super(context, attrs, defStyle);
mUiThreadId = Thread.currentThread().getId();
initProgressBar();
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ProgressBar, defStyle, styleRes);
mNoInvalidate = true;
Drawable drawable = a.getDrawable(R.styleable.ProgressBar_android_progressDrawable);
if (drawable != null) {
drawable = tileify(drawable, false);
setProgressDrawable(drawable);
}
mDuration = a.getInt(
R.styleable.ProgressBar_android_indeterminateDuration,
mDuration);
mMinWidth = a.getDimensionPixelSize(
R.styleable.ProgressBar_android_minWidth, mMinWidth);
mMaxWidth = a.getDimensionPixelSize(
R.styleable.ProgressBar_android_maxWidth, mMaxWidth);
mMinHeight = a.getDimensionPixelSize(
R.styleable.ProgressBar_android_minHeight, mMinHeight);
mMaxHeight = a.getDimensionPixelSize(
R.styleable.ProgressBar_android_maxHeight, mMaxHeight);
mBehavior = a.getInt(
R.styleable.ProgressBar_android_indeterminateBehavior,
mBehavior);
final int resID = a.getResourceId(
R.styleable.ProgressBar_android_interpolator,
android.R.anim.linear_interpolator);
if (resID > 0) {
setInterpolator(context, resID);
}
setMax(a.getInt(R.styleable.ProgressBar_android_max, mMax));
setProgress(a.getInt(R.styleable.ProgressBar_android_progress,
mProgress));
setSecondaryProgress(a.getInt(
R.styleable.ProgressBar_android_secondaryProgress,
mSecondaryProgress));
drawable = DrawableCompat.getDrawable(a,
R.styleable.ProgressBar_android_indeterminateDrawable);
if (drawable != null) {
drawable = tileifyIndeterminate(drawable);
setIndeterminateDrawable(drawable);
}
mOnlyIndeterminate = a.getBoolean(
R.styleable.ProgressBar_android_indeterminateOnly,
mOnlyIndeterminate);
mNoInvalidate = false;
setIndeterminate(mOnlyIndeterminate
|| a.getBoolean(R.styleable.ProgressBar_android_indeterminate,
mIndeterminate));
a.recycle();
}
示例9: ImageButton
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
public ImageButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mStateOverlay = new DrawableCompat.StateOverlay(this, context, attrs, defStyle);
}
示例10: ProgressBar
import org.holoeverywhere.drawable.DrawableCompat; //导入依赖的package包/类
public ProgressBar(Context context, AttributeSet attrs, int defStyle,
int styleRes) {
super(context, attrs, defStyle);
mUiThreadId = Thread.currentThread().getId();
initProgressBar();
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ProgressBar, defStyle, styleRes);
mNoInvalidate = true;
Drawable drawable = a.getDrawable(R.styleable.ProgressBar_android_progressDrawable);
if (drawable != null) {
drawable = tileify(drawable, false);
setProgressDrawable(drawable);
}
mDuration = a.getInt(
R.styleable.ProgressBar_android_indeterminateDuration,
mDuration);
mMinWidth = a.getDimensionPixelSize(
R.styleable.ProgressBar_android_minWidth, mMinWidth);
mMaxWidth = a.getDimensionPixelSize(
R.styleable.ProgressBar_android_maxWidth, mMaxWidth);
mMinHeight = a.getDimensionPixelSize(
R.styleable.ProgressBar_android_minHeight, mMinHeight);
mMaxHeight = a.getDimensionPixelSize(
R.styleable.ProgressBar_android_maxHeight, mMaxHeight);
mBehavior = a.getInt(
R.styleable.ProgressBar_android_indeterminateBehavior,
mBehavior);
final int resID = a.getResourceId(
R.styleable.ProgressBar_android_interpolator,
android.R.anim.linear_interpolator);
if (resID > 0) {
setInterpolator(context, resID);
}
setMax(a.getInt(R.styleable.ProgressBar_android_max, mMax));
setProgress(a.getInt(R.styleable.ProgressBar_android_progress,
mProgress));
setSecondaryProgress(a.getInt(
R.styleable.ProgressBar_android_secondaryProgress,
mSecondaryProgress));
drawable = DrawableCompat.getDrawable(a,
R.styleable.ProgressBar_android_indeterminateDrawable);
if (drawable != null) {
drawable = tileifyIndeterminate(drawable);
setIndeterminateDrawable(drawable);
}
mOnlyIndeterminate = a.getBoolean(
R.styleable.ProgressBar_android_indeterminateOnly,
mOnlyIndeterminate);
mNoInvalidate = false;
setIndeterminate(mOnlyIndeterminate
|| a.getBoolean(R.styleable.ProgressBar_android_indeterminate,
mIndeterminate));
a.recycle();
}