當前位置: 首頁>>代碼示例>>Java>>正文


Java Drawable.addState方法代碼示例

本文整理匯總了Java中android.graphics.drawable.Drawable.addState方法的典型用法代碼示例。如果您正苦於以下問題:Java Drawable.addState方法的具體用法?Java Drawable.addState怎麽用?Java Drawable.addState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.drawable.Drawable的用法示例。


在下文中一共展示了Drawable.addState方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCheckStatusDrawable

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public Drawable getCheckStatusDrawable(String origin, String checked, String pressed, String checkpressed, boolean is9Png) {
    int originId = this.mResources.getIdentifier(origin, "drawable", this.packageName);
    int selectId = this.mResources.getIdentifier(checked, "drawable", this.packageName);
    int pressedId = this.mResources.getIdentifier(pressed, "drawable", this.packageName);
    int selectpressId = this.mResources.getIdentifier(checkpressed, "drawable", this.packageName);
    if (originId == 0 && selectId == 0 && pressedId == 0 && selectpressId == 0) {
        String suffix = (is9Png ? ".9" : "") + ".png";
        return new StateListDrawableBuilder(this.mContext, "drawable/" + origin + suffix).setPressDrawable("drawable/" + pressed + suffix).setCheckedDrawable("drawable/" + checked + suffix).setPressCheckedDrawable("drawable/" + checkpressed + suffix).create();
    }
    Drawable mStateListDrawable = new StateListDrawable();
    mStateListDrawable.addState(new int[]{16842912}, this.mResources.getDrawable(selectId));
    mStateListDrawable.addState(new int[]{16842919}, this.mResources.getDrawable(pressedId));
    mStateListDrawable.addState(new int[]{16842919, 16842912}, this.mResources.getDrawable(selectpressId));
    mStateListDrawable.addState(new int[0], this.mResources.getDrawable(originId));
    return mStateListDrawable;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:17,代碼來源:CustomResourceMgmt.java

示例2: b

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void b(Button button) {
    Drawable stateListDrawable = new StateListDrawable();
    Drawable a = this.a.b("com.tencent.plus.gray_normal.png");
    Drawable a2 = this.a.b("com.tencent.plus.gray_down.png");
    Drawable a3 = this.a.b("com.tencent.plus.gray_disable.png");
    stateListDrawable.addState(View.PRESSED_ENABLED_STATE_SET, a2);
    stateListDrawable.addState(View.ENABLED_FOCUSED_STATE_SET, a);
    stateListDrawable.addState(View.ENABLED_STATE_SET, a);
    stateListDrawable.addState(View.FOCUSED_STATE_SET, a);
    stateListDrawable.addState(View.EMPTY_STATE_SET, a3);
    button.setBackgroundDrawable(stateListDrawable);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:ImageActivity.java

示例3: getStatusDrawable

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public Drawable getStatusDrawable(String origin, String press, boolean is9Png) {
    int originId = this.mResources.getIdentifier(origin, "drawable", this.packageName);
    int pressId = this.mResources.getIdentifier(press, "drawable", this.packageName);
    if (originId == 0 && pressId == 0) {
        String suffix = (is9Png ? ".9" : "") + ".png";
        return new StateListDrawableBuilder(this.mContext, "drawable/" + origin + suffix).setPressDrawable("drawable/" + press + suffix).create();
    }
    Drawable mStateListDrawable = new StateListDrawable();
    mStateListDrawable.addState(new int[]{16842919, 16842910}, this.mResources.getDrawable(pressId));
    mStateListDrawable.addState(new int[0], this.mResources.getDrawable(originId));
    return mStateListDrawable;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:CustomResourceMgmt.java


注:本文中的android.graphics.drawable.Drawable.addState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。