本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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());
}