本文整理汇总了Java中android.graphics.drawable.RotateDrawable类的典型用法代码示例。如果您正苦于以下问题:Java RotateDrawable类的具体用法?Java RotateDrawable怎么用?Java RotateDrawable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RotateDrawable类属于android.graphics.drawable包,在下文中一共展示了RotateDrawable类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setDrawableColor
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
/**
* Sets the background color of the drawable
**/
public static void setDrawableColor(Context context, Drawable drawable, @AttrRes int colorAttrRes) {
int colorRes = getResourceId(context, colorAttrRes);
int color = ContextCompat.getColor(context, colorRes);
if (drawable instanceof ShapeDrawable) {
((ShapeDrawable) drawable).getPaint().setColor(color);
} else if (drawable instanceof GradientDrawable) {
((GradientDrawable) drawable).setColor(color);
} else if (drawable instanceof ColorDrawable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
((ColorDrawable) drawable).setColor(color);
}
} else if (drawable instanceof RotateDrawable) {
setDrawableColor(context, ((RotateDrawable) drawable).getDrawable(), colorAttrRes);
}
}
开发者ID:kaliturin,项目名称:BlackList,代码行数:19,代码来源:Utils.java
示例2: setColor
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
private void setColor(Drawable drawable, int color) {
if (drawable instanceof ShapeDrawable) {
((ShapeDrawable) drawable).getPaint().setColor(color);
} else if (drawable instanceof GradientDrawable) {
((GradientDrawable) drawable).setColor(color);
} else if (drawable instanceof ColorDrawable) {
((ColorDrawable) drawable).setColor(color);
} else if (drawable instanceof LayerDrawable) {
LayerDrawable layerDrawable = (LayerDrawable) drawable;
RotateDrawable rotateDrawable =
(RotateDrawable) layerDrawable.findDrawableByLayerId(R.id.carrot_shape_top);
setColor(rotateDrawable.getDrawable(), color);
} else if (drawable instanceof RotateDrawable) {
setColor(((RotateDrawable) drawable).getDrawable(), color);
}
}
开发者ID:harsh159357,项目名称:InstaTag,代码行数:17,代码来源:InstaTag.java
示例3: ClassDescRotateDrawable
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
public ClassDescRotateDrawable(ClassDescDrawableMgr classMgr,ClassDescElementDrawableBased<? super RotateDrawable> parent)
{
super(classMgr,"rotate",parent);
this.rotateStateField = new FieldContainer<Drawable.ConstantState>(RotateDrawable.class, "mState");
Class rotateStateClass = MiscUtil.resolveClass(RotateDrawable.class.getName() + "$RotateState");
if (Build.VERSION.SDK_INT >= MiscUtil.MARSHMALLOW) // level 23, v6.0
this.mDrawableField = new FieldContainer<Drawable>("android.graphics.drawable.DrawableWrapper", "mDrawable");
else
this.mDrawableField = new FieldContainer<Drawable>(rotateStateClass, "mDrawable");
this.mPivotXRelField = new FieldContainer<Boolean>(rotateStateClass, "mPivotXRel");
this.mPivotXField = new FieldContainer<Float>(rotateStateClass, "mPivotX");
this.mPivotYRelField = new FieldContainer<Boolean>(rotateStateClass, "mPivotYRel");
this.mPivotYField = new FieldContainer<Float>(rotateStateClass, "mPivotY");
this.mFromDegreesField = new FieldContainer<Float>(rotateStateClass, "mFromDegrees");
this.mCurrentDegreesField = new FieldContainer<Float>(rotateStateClass, "mCurrentDegrees");
this.mToDegreesField = new FieldContainer<Float>(rotateStateClass, "mToDegrees");
}
开发者ID:jmarranz,项目名称:itsnat_droid,代码行数:21,代码来源:ClassDescRotateDrawable.java
示例4: setIsSender
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
private void setIsSender(boolean isSender) {
final int color;
if (isSender) {
color = mGreen300;
mLeftArrow.setVisibility(View.GONE);
mRightArrow.setVisibility(View.VISIBLE);
mMessageContainer.setGravity(Gravity.END);
} else {
color = mGray300;
mLeftArrow.setVisibility(View.VISIBLE);
mRightArrow.setVisibility(View.GONE);
mMessageContainer.setGravity(Gravity.START);
}
((GradientDrawable) mMessage.getBackground()).setColor(color);
((RotateDrawable) mLeftArrow.getBackground()).getDrawable()
.setColorFilter(color, PorterDuff.Mode.SRC);
((RotateDrawable) mRightArrow.getBackground()).getDrawable()
.setColorFilter(color, PorterDuff.Mode.SRC);
}
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:21,代码来源:ChatHolder.java
示例5: setupBadgeBackgroundColors
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
private void setupBadgeBackgroundColors(String BADGE_COLOR) {
GradientDrawable gd = (GradientDrawable) outer_container.getBackground();
gd.setColor(Color.parseColor(BADGE_COLOR));
LayerDrawable layers = (LayerDrawable) bottom_arrow.getBackground();
RotateDrawable rotate = (RotateDrawable) layers.findDrawableByLayerId(R.id.grad);
GradientDrawable drawable = (GradientDrawable) rotate.getDrawable();
drawable.setColor(Color.parseColor(BADGE_COLOR));
}
开发者ID:salRoid,项目名称:InstaBadge,代码行数:12,代码来源:InstaBadgeView.java
示例6: isAttributeIgnored
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
@Override
public boolean isAttributeIgnored(RotateDrawable resource, String namespaceURI, String name)
{
if (super.isAttributeIgnored(resource,namespaceURI,name))
return true;
if (NamespaceUtil.XMLNS_ANDROID.equals(namespaceURI))
{
// Se usan en tiempo de construcción
return ("drawable".equals(name) || "pivotX".equals(name) || "pivotY".equals(name) || "fromDegrees".equals(name) || "toDegrees".equals(name));
}
return false;
}
开发者ID:jmarranz,项目名称:itsnat_droid,代码行数:14,代码来源:ClassDescRotateDrawable.java
示例7: assertEquals
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
public static void assertEquals(RotateDrawable a,RotateDrawable b)
{
assertEqualsDrawableWrapper(a, b);
//assertEquals(a.getDrawable(), b.getDrawable());
Class classState = TestUtil.resolveClass(RotateDrawable.class.getName() + "$RotateState");
Drawable.ConstantState a_state;
Drawable.ConstantState b_state;
if (Build.VERSION.SDK_INT < TestUtil.MARSHMALLOW) // 23
{
a_state = a.getConstantState();
b_state = b.getConstantState();
}
else // >= 23
{
a_state = (Drawable.ConstantState)TestUtil.getField(a, RotateDrawable.class, "mState");
b_state = (Drawable.ConstantState)TestUtil.getField(b, RotateDrawable.class, "mState"); // Devuelve null no se porqué con b.getConstantState()
}
assertEquals((Boolean) TestUtil.getField(a_state, classState, "mPivotXRel"), (Boolean) TestUtil.getField(b_state, classState, "mPivotXRel"));
assertEquals((Float) TestUtil.getField(a_state, classState, "mPivotX"), (Float) TestUtil.getField(b_state, classState, "mPivotX"));
assertEquals((Boolean) TestUtil.getField(a_state, classState, "mPivotYRel"), (Boolean) TestUtil.getField(b_state, classState, "mPivotYRel"));
assertEquals((Float) TestUtil.getField(a_state, classState, "mPivotY"), (Float) TestUtil.getField(b_state, classState, "mPivotY"));
assertEquals((Float) TestUtil.getField(a_state, classState, "mFromDegrees"), (Float) TestUtil.getField(b_state, classState, "mFromDegrees"));
assertEquals((Float) TestUtil.getField(a_state, classState, "mToDegrees"), (Float) TestUtil.getField(b_state, classState, "mToDegrees"));
// android:drawable
if (Build.VERSION.SDK_INT < TestUtil.MARSHMALLOW) // 23
{
assertEquals((Drawable) TestUtil.getField(a_state, classState, "mDrawable"), (Drawable) TestUtil.getField(b_state, classState, "mDrawable"));
}
}
开发者ID:jmarranz,项目名称:itsnat_droid,代码行数:37,代码来源:Assert.java
示例8: connectWidgets
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
void connectWidgets(View v) {
dgRespondBg = (GradientDrawable)
((RotateDrawable)
((LayerDrawable) v.getBackground())
.findDrawableByLayerId(R.id.drRespondBg))
.getDrawable();
btnContinue = (Button) v.findViewById(R.id.btnContinue);
if (isDonate)
connectDonateWidgets(v);
else
connectRsvpWidgets(v);
}
开发者ID:samv,项目名称:AshaNetApp,代码行数:13,代码来源:RespondFragment.java
示例9: connectWidgets
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
void connectWidgets() {
lvStream = (ListView) findViewById(R.id.lvStream);
tvTitle = (TextView) findViewById(R.id.tvTitle);
tvWhen = (TextView) findViewById(R.id.tvWhen);
ivBottomGradient = (ImageView) findViewById(R.id.ivBottomGradient);
tvSubtitle = (TextView) findViewById(R.id.tvSubtitle);
tvDescription = (TextView) findViewById(R.id.tvDescription);
flRespond = (FrameLayout) findViewById(R.id.flRespond);
ivRespondSlotBg = (ImageView) findViewById(R.id.ivRespondSlotBg);
ivRespondSlotBg.setOnClickListener(this);
LayerDrawable ldRespondSlotBg = (LayerDrawable)
ivRespondSlotBg.getDrawable();
Log.d("DEBUG", "ldrsb = " + ldRespondSlotBg);
dgRespondSlotBg = (GradientDrawable)
((RotateDrawable)
ldRespondSlotBg.findDrawableByLayerId(R.id.drRespondSlotBg))
.getDrawable();
dgRespondSlot = (GradientDrawable)
((RotateDrawable)
ldRespondSlotBg.findDrawableByLayerId(R.id.drRespondSlot))
.getDrawable();
dgStream = (GradientDrawable) ivBottomGradient.getDrawable();
tvRespondIcon = (TextView) findViewById(R.id.tvRespondIcon);
tvRespondIcon.setOnClickListener(this);
ivRespondSlotFg = (ImageView) findViewById(R.id.ivRespondSlotFg);
dgRespondSlotFg = (GradientDrawable)
((RotateDrawable)
((LayerDrawable) ivRespondSlotFg.getDrawable())
.findDrawableByLayerId(R.id.drRespondSlotFg))
.getDrawable();
Log.d("DEBUG", "Drawables: " +
"dgRespondSlot=" + dgRespondSlot
+ ", dgRespondSlotFg=" + dgRespondSlotFg
+ ", dgRespondSlotBg=" + dgRespondSlotBg
+ ", dgStream=" + dgStream);
}
开发者ID:samv,项目名称:AshaNetApp,代码行数:41,代码来源:StreamActivity.java
示例10: PlayingIndicator
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
public PlayingIndicator(Context context, AttributeSet attrs) {
super(context, attrs);
setImageResource(R.drawable.now_playing_animated);
mRotateDrawable = (RotateDrawable) getDrawable();
if (!VersionUtils.hasLollipop()) {
mRotateDrawable.setColorFilter(ThemeUtils.getColorAccent(getContext()), PorterDuff.Mode.SRC_IN);
}
}
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:9,代码来源:PlayingIndicator.java
示例11: PlayingIndicator
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
public PlayingIndicator(Context context, AttributeSet attrs) {
super(context, attrs);
setImageResource(R.drawable.now_playing_indicator);
mRotateDrawable = (RotateDrawable) getDrawable();
if (!VersionUtils.hasLollipop()) {
mRotateDrawable.setColorFilter(ThemeUtils.getColorAccent(getContext()), PorterDuff.Mode.SRC_IN);
}
}
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:9,代码来源:PlayingIndicator.java
示例12: applySingleMode
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
protected void applySingleMode(TypedArray array){
RotateDrawable d = (RotateDrawable) getResources().getDrawable(R.drawable.spinner_single);
GradientDrawable gradient = (GradientDrawable) d.getDrawable();
int startColor = array.getColor(R.styleable.ColorProgressBar_startColor, -1);
int middleColor = array.getColor(R.styleable.ColorProgressBar_middleColor, -1);
int endColor = array.getColor(R.styleable.ColorProgressBar_endColor, -1);
if (startColor == -1){
throw new IllegalArgumentException("You have not specified a start color");
}
if (endColor == -1){
endColor = getResources().getColor(R.color.spinner_single_default_end);
}
if (middleColor == -1){
middleColor = getResources().getColor(R.color.spinner_single_default_middle);
}
gradient.setColors(new int[]{startColor, endColor, middleColor});
setIndeterminateDrawable(d);
}
开发者ID:sockeqwe,项目名称:ColorProgressBar,代码行数:28,代码来源:ColorProgressBar.java
示例13: onResume
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
@Override
public void onResume(){
super.onResume();
getPreferenceScreen().getSharedPreferences()
.registerOnSharedPreferenceChangeListener(this);
LayerDrawable drawPref = (LayerDrawable)getResources().getDrawable(R.drawable.draw_pref);
GradientDrawable backPref = (GradientDrawable) drawPref.findDrawableByLayerId(R.id.backtemp);
LayerDrawable drawWifi = (LayerDrawable)getResources().getDrawable(R.drawable.draw_wifi);
GradientDrawable backWifi = (GradientDrawable) drawWifi.findDrawableByLayerId(R.id.backtemp);
LayerDrawable drawBluetooth = (LayerDrawable)getResources().getDrawable(R.drawable.draw_bluetooth);
GradientDrawable backBluetooth = (GradientDrawable) drawBluetooth.findDrawableByLayerId(R.id.backtemp);
LayerDrawable drawGPS = (LayerDrawable)getResources().getDrawable(R.drawable.draw_gps);
GradientDrawable backGPS = (GradientDrawable) drawGPS.findDrawableByLayerId(R.id.backtemp);
LayerDrawable drawTime = (LayerDrawable)getResources().getDrawable(R.drawable.draw_time);
GradientDrawable backTime = (GradientDrawable) drawTime.findDrawableByLayerId(R.id.backtemp);
LayerDrawable drawGeekyLauncher = (LayerDrawable)getResources().getDrawable(R.drawable.draw_geekylauncher);
RotateDrawable backGL = (RotateDrawable) drawGeekyLauncher.findDrawableByLayerId(R.id.backtemp);
LayerDrawable drawPro = (LayerDrawable)getResources().getDrawable(R.drawable.draw_pref_pro);
GradientDrawable backPro = (GradientDrawable) drawPro.findDrawableByLayerId(R.id.backtemp);
GradientDrawable backPro2 = (GradientDrawable) drawPro.findDrawableByLayerId(R.id.backtemp2);
backPref.setColor(themeColor);
backWifi.setColor(themeColor);
backBluetooth.setColor(themeColor);
backGPS.setColor(themeColor);
backTime.setColor(themeColor);
backPro.setColor(themeColor); backPro2.setColor(themeColor);
backGL.setDrawable(new ColorDrawable(themeColor));
stable.setIcon(drawPref);
widget.setIcon(drawPref);
autoremove.setIcon(drawPref);
autorecovs.setIcon(drawPref);
autotrans.setIcon(drawPref);
style.setIcon(drawPref);
colortext.setIcon(drawPref);
sizes.setIcon(drawPref);
overview.setIcon(drawPref);
prefwifi.setIcon(drawWifi);
prefbluetooth.setIcon(drawBluetooth);
prefgps.setIcon(drawGPS);
preftime.setIcon(drawTime);
launcher.setIcon(drawGeekyLauncher);
ad.setIcon(drawPro);
}
开发者ID:GeeksEmpireNet,项目名称:Shortcuts,代码行数:54,代码来源:SettingGUI.java
示例14: createElementDrawableChildRoot
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
@Override
public ElementDrawableChildRoot createElementDrawableChildRoot(DOMElemDrawable rootElem, AttrDrawableContext attrCtx)
{
ElementDrawableChildRoot elementDrawableRoot = new ElementDrawableChildRoot();
RotateDrawable drawable = new RotateDrawable();
XMLInflaterContext xmlInflaterContext = attrCtx.getXMLInflaterContext();
XMLInflaterDrawable xmlInflaterDrawable = attrCtx.getXMLInflaterDrawable();
xmlInflaterDrawable.processChildElements(rootElem, elementDrawableRoot,attrCtx);
ArrayList<ElementDrawableChildBase> childList = elementDrawableRoot.getElementDrawableChildList();
XMLInflaterRegistry xmlInflaterRegistry = classMgr.getXMLInflaterRegistry();
Drawable.ConstantState rotateState = rotateStateField.get(drawable);
Drawable childDrawable = getDrawableChild("drawable", rootElem, xmlInflaterContext, childList);
if (Build.VERSION.SDK_INT >= MiscUtil.MARSHMALLOW) // level 23, v6.0
mDrawableField.set(drawable,childDrawable);
else
mDrawableField.set(rotateState,childDrawable);
DOMAttr pivotXAttr = rootElem.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "pivotX");
PercFloatImpl pivotXObj = pivotXAttr != null ? xmlInflaterRegistry.getDimensionPercFloat(pivotXAttr.getResourceDesc(),xmlInflaterContext) : null;
boolean pivotXRel;
float pivotX;
if (pivotXObj == null)
{
pivotXRel = true;
pivotX = 0.5f;
}
else
{
pivotXRel = pivotXObj.getDataType() == TypedValue.TYPE_FRACTION;
pivotX = pivotXObj.toFloatBasedOnDataType();
}
mPivotXRelField.set(rotateState,pivotXRel);
mPivotXField.set(rotateState,pivotX);
DOMAttr pivotYAttr = rootElem.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "pivotY");
PercFloatImpl pivotYObj = pivotYAttr != null ? xmlInflaterRegistry.getDimensionPercFloat(pivotYAttr.getResourceDesc(),xmlInflaterContext) : null;
boolean pivotYRel;
float pivotY;
if (pivotYObj == null)
{
pivotYRel = true;
pivotY = 0.5f;
}
else
{
pivotYRel = pivotYObj.getDataType() == TypedValue.TYPE_FRACTION;
pivotY = pivotYObj.toFloatBasedOnDataType();
}
mPivotYRelField.set(rotateState,pivotYRel);
mPivotYField.set(rotateState,pivotY);
DOMAttr fromDegreesAttr = rootElem.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "fromDegrees");
float fromDegrees = fromDegreesAttr != null ? xmlInflaterRegistry.getFloat(fromDegreesAttr.getResourceDesc(),xmlInflaterContext) : 0.0f;
mFromDegreesField.set(rotateState,fromDegrees);
mCurrentDegreesField.set(rotateState,fromDegrees);
DOMAttr toDegreesAttr = rootElem.getDOMAttribute(NamespaceUtil.XMLNS_ANDROID, "toDegrees");
float toDegrees = toDegreesAttr != null ? xmlInflaterRegistry.getFloat(toDegreesAttr.getResourceDesc(),xmlInflaterContext) : 360.0f;
mToDegreesField.set(rotateState,toDegrees);
setCallback(childDrawable,drawable); // childDrawable no puede ser nulo
elementDrawableRoot.setDrawable(drawable);
return elementDrawableRoot;
}
开发者ID:jmarranz,项目名称:itsnat_droid,代码行数:73,代码来源:ClassDescRotateDrawable.java
示例15: getDrawableOrElementDrawableClass
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
@Override
public Class<RotateDrawable> getDrawableOrElementDrawableClass()
{
return RotateDrawable.class;
}
开发者ID:jmarranz,项目名称:itsnat_droid,代码行数:6,代码来源:ClassDescRotateDrawable.java
示例16: createTag
import android.graphics.drawable.RotateDrawable; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static Drawable createTag(String color) {
ShapeDrawable shapeDrawableM = new ShapeDrawable(new RectShape());
// shapeDrawableM.getShape().resize(100, 100);
shapeDrawableM.setBounds(0, 0, 100, 20);
shapeDrawableM.getPaint().setColor(Color.parseColor(color));
// <size android:width="100dp" android:height="20dp"/>
// <corners android:radius="0dp"/>
RotateDrawable rotateDrawable = new RotateDrawable();
ShapeDrawable shapeDrawable = new ShapeDrawable(new RectShape());
shapeDrawable.getPaint().setColor(Color.parseColor("#ffffff"));
rotateDrawable.setFromDegrees(45.0f);
rotateDrawable.setDrawable(shapeDrawable);
RotateDrawable rotateDrawable1 = new RotateDrawable();
ShapeDrawable shapeDrawable1 = new ShapeDrawable(new RectShape());
shapeDrawable1.getPaint().setColor(Color.parseColor("#ffffff"));
rotateDrawable1.setFromDegrees(-45.0f);
rotateDrawable1.setDrawable(shapeDrawable1);
Drawable[] layers = {shapeDrawableM, rotateDrawable, rotateDrawable1};
LayerDrawable layerDrawable = new LayerDrawable(layers);
layerDrawable.setLayerInset(1, 0, -40, -20, 38);
layerDrawable.setLayerInset(2, 0, 40, -20, -50);
return layerDrawable;
}
开发者ID:voudeonibus,项目名称:vdb-android,代码行数:40,代码来源:TagArrowUtils.java
注:本文中的android.graphics.drawable.RotateDrawable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论