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


Java TextView.setShadowLayer方法代碼示例

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


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

示例1: showMessage

import android.widget.TextView; //導入方法依賴的package包/類
private void showMessage(String message) {
    final TextView t = new TextView(this);
    t.setTextSize(36);
    t.setShadowLayer(16, 2, 2, Color.WHITE);
    t.setText(message);
    t.setTextColor(Color.BLACK);
    t.setBackgroundColor(Color.argb(127,64,64,64));
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.CENTER;
    mMainScreen.addView(t, lp);
    mMainScreen.requestLayout();
    mMainScreen.postDelayed(new Runnable() {
        @Override
        public void run() {
            mMainScreen.removeView(t);
        }
    }, 2000);

}
 
開發者ID:quaap,項目名稱:DodaTheExploda,代碼行數:20,代碼來源:MainActivity.java

示例2: getView

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = li.inflate(R.layout.swatch, null);
    }
    String name = colors.get(position);
    int color = Card.COLORS.get(name);
    if (color == Card.DEFAULT_COLOR || color == Card.NO_CARD_COLOR) color = Color.TRANSPARENT;
    TextView tv = (TextView) convertView;
    tv.setText(name.split(":")[0]);
    if(color!=Color.TRANSPARENT&&MainActivity.useBlackText(color)){
        tv.setTextColor(Card.COLORS.get("Black"));
        tv.setShadowLayer(0,0,0,Color.WHITE);
    }else{
        tv.setTextColor(Color.WHITE);
        tv.setShadowLayer(2,1,1,Card.COLORS.get("Black"));
    }
    tv.setBackgroundColor(color);
    return tv;
}
 
開發者ID:jathak,項目名稱:sflauncher,代碼行數:21,代碼來源:ColorAdapter.java

示例3: updateUI

import android.widget.TextView; //導入方法依賴的package包/類
public void updateUI() {
    this.recoAppName.setText(this.mrecoApp.getName());
    String[] split = this.mrecoApp.getDesc().split("/");
    if (split.length == 2) {
        this.reco_desp.setPadding(0, 0, 0, 60);
    }
    for (CharSequence text : split) {
        TextView tv = new TextView(this);
        tv.setLayoutParams(new LayoutParams(-1, -1, 1.0f));
        tv.setShadowLayer(3.0f, 3.0f, 1.0f, 2131493090);
        tv.setTextColor(-1);
        tv.setGravity(1);
        tv.setText(text);
        tv.setTextSize(18.0f);
        this.reco_desp.addView(tv);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:18,代碼來源:NewFeatureActivity.java

示例4: makeText

import android.widget.TextView; //導入方法依賴的package包/類
public static Toast makeText(Context context, CharSequence text, int duration) {
    Toast result = Toast.makeText(context, text, duration);
    result.getView().setBackgroundResource(R.drawable.tt_waterfall_refresh_bg);
    result.setGravity(Gravity.CENTER, 0, 0);
    TextView tv = (TextView) ((ViewGroup) result.getView()).getChildAt(0);
    ScreenTools tools = ScreenTools.instance(context);

    tv.setPadding(tools.dip2px(5), tools.dip2px(8), tools.dip2px(5),
            tools.dip2px(8));
    tv.setShadowLayer(0, 0, 0, Color.TRANSPARENT);
    tv.setMinWidth(tools.dip2px(180));
    tv.setGravity(Gravity.CENTER);
    tv.setTextColor(context.getResources().getColor(android.R.color.white));
    return result;
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:16,代碼來源:PinkToast.java

示例5: getView

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    if (convertView == null) {
        final ViewGroup nullParent = null;
        convertView = mLayoutInflater.inflate(R.layout.theme_dialog, nullParent);
    }

    String theme = themeOptions[position];

    TextView txtView = convertView.findViewById(R.id.title);
    txtView.setText(theme);

    RadioButton radioButton = convertView.findViewById(R.id.radio);

    int itemColor = ContextCompat.getColor(context, resolveColor(position));

    ColorStateList colorStateList = new ColorStateList(
            new int[][]{
                    new int[]{android.R.attr.state_enabled}, //enabled
                    new int[]{android.R.attr.state_enabled} //disabled

            },
            new int[]{itemColor, itemColor}
    );

    txtView.setShadowLayer(1.5f, -1, 1, itemColor);
    radioButton.setButtonTintList(colorStateList);

    radioButton.setChecked(themeValues[position].equals(selectedTheme));
    return convertView;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:33,代碼來源:ThemePreference.java

示例6: styleCategoryStyle

import android.widget.TextView; //導入方法依賴的package包/類
public void styleCategoryStyle(TextView categoryTab, CategoryTabStyle catstyle) {


        switch (catstyle) {
            case Tiny:
                categoryTab.setPadding(6, categoryTabPaddingHeight/5, 2, categoryTabPaddingHeight/5);
                categoryTab.setTextColor(cattabTextColor);
                categoryTab.setBackgroundColor(cattabBackground);
                categoryTab.setTextSize(categoryTabFontSize-3);
                categoryTab.setShadowLayer(0, 0, 0, 0);
                break;
            case DragHover:
                categoryTab.setPadding(6, categoryTabPaddingHeight, 2, categoryTabPaddingHeight);
                categoryTab.setTextColor(cattabTextColor);
                categoryTab.setBackgroundColor(dragoverBackground);
                categoryTab.setTextSize(categoryTabFontSize);
                categoryTab.setShadowLayer(0, 0, 0, 0);
                break;
            case Selected:
                categoryTab.setPadding(6, categoryTabPaddingHeight, 2, categoryTabPaddingHeight);
                categoryTab.setTextColor(cattabSelectedText);
                categoryTab.setBackgroundColor(cattabSelectedBackground);
                categoryTab.setTextSize(categoryTabFontSize);
                categoryTab.setShadowLayer(8, 4, 4, cattabTextColorInvert);
                break;
            case Normal:
            default:
                categoryTab.setPadding(6, categoryTabPaddingHeight, 2, categoryTabPaddingHeight);
                categoryTab.setTextColor(cattabTextColor);
                categoryTab.setBackgroundColor(cattabBackground);
                categoryTab.setTextSize(categoryTabFontSize);
                categoryTab.setShadowLayer(0, 0, 0, 0);
        }
    }
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:35,代碼來源:Style.java

示例7: process

import android.widget.TextView; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void process(@NonNull Context context, @Nullable String key, @NonNull View view, @NonNull String suffix) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
        return;
    final TextView tv = (TextView) view;
    final ColorResult result = getColorFromSuffix(context, key, view, suffix);
    if (result == null) return;
    tv.setShadowLayer(tv.getShadowRadius(), tv.getShadowDx(), tv.getShadowDy(), result.getColor());
}
 
開發者ID:RajneeshSingh007,項目名稱:MusicX-music-player,代碼行數:11,代碼來源:TextShadowColorTagProcessor.java


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