Java Code Examples for android.widget.TextView.setShadowLayer()

The following are Jave code examples for showing how to use setShadowLayer() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DodaTheExploda   File: MainActivity.java   View Source Code Vote up 6 votes
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);

}
 
Example 2
Project: sflauncher   File: ColorAdapter.java   View Source Code Vote up 6 votes
@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;
}
 
Example 3
Project: letv   File: NewFeatureActivity.java   View Source Code Vote up 6 votes
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);
    }
}
 
Example 4
Project: sctalk   File: PinkToast.java   View Source Code Vote up 6 votes
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;
}
 
Example 5
Project: LaunchEnr   File: ThemePreference.java   View Source Code Vote up 5 votes
@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;
}
 
Example 6
Project: LaunchTime   File: Style.java   View Source Code Vote up 5 votes
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);
        }
    }
 
Example 7
Project: MusicX-music-player   File: TextShadowColorTagProcessor.java   View Source Code Vote up 5 votes
@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());
}
 
Example 8
Project: sctalk   File: PinkToast.java   View Source Code Vote up 5 votes
public static Toast makeText(Context context, int id, int duration) {
    Toast result = Toast.makeText(context, id, 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;
}