本文整理汇总了Java中android.graphics.drawable.ColorDrawable.setAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java ColorDrawable.setAlpha方法的具体用法?Java ColorDrawable.setAlpha怎么用?Java ColorDrawable.setAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.ColorDrawable
的用法示例。
在下文中一共展示了ColorDrawable.setAlpha方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setImageBitmap
import android.graphics.drawable.ColorDrawable; //导入方法依赖的package包/类
private void setImageBitmap(Bitmap bitmap) {
if (bitmap != null) {
// menu 中有图标时要通过 getHeaderView 查找子 view
View headerView = navigationView.getHeaderView(0);
ImageView iv = (ImageView) headerView.findViewById(R.id.main_left_nav_image);
iv.setImageBitmap(bitmap);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ColorDrawable cd = new ColorDrawable(Color.BLACK);
int alpha = appPreference.getImageWallAlpha();
cd.setAlpha(alpha);
iv.setForeground(cd);
}
Animation animation = AnimationUtils.loadAnimation(activity, android.R.anim.fade_in);
iv.startAnimation(animation);
}
}
示例2: onViewCreated
import android.graphics.drawable.ColorDrawable; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mSearchView = (FloatingSearchView) view.findViewById(R.id.floating_search_view);
mHeaderView = (TextView)view.findViewById(R.id.header_view);
mSearchResultsList = (RecyclerView) view.findViewById(R.id.search_results_list);
mDimSearchViewBackground = view.findViewById(R.id.dim_background);
mDimDrawable = new ColorDrawable(Color.BLACK);
mDimDrawable.setAlpha(0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mDimSearchViewBackground.setBackground(mDimDrawable);
}else {
mDimSearchViewBackground.setBackgroundDrawable(mDimDrawable);
}
smar_group_id = checkSmarGroup();
isFocus = false;
setupFloatingSearch();
setupResultsList();
setupDrawer();
Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/league.ttf");
mHeaderView.setTypeface(font);
}
示例3: themeChange
import android.graphics.drawable.ColorDrawable; //导入方法依赖的package包/类
@Override
public void themeChange(ThemeEnum themeEnum, int[] colors) {
int[] cs = ColorUtils.get10ThemeColors(activity, themeEnum);
int statusC = cs[0];
int toolbarC = cs[1];
int accentC = cs[2];
int mainBC = cs[3];
int vicBC = cs[4];
int mainTC = cs[5];
int vicTC = cs[6];
int navC = cs[7];
int toolbarMainTC = cs[8];
int toolbarVicTC = cs[9];
listViewsController.themeChange(themeEnum, cs);
mContainer.setBackgroundColor(navC);
mName.setTextColor(mainTC);
mArts.setTextColor(vicTC);
mPlay.setPauseLineColor(mainTC);
mPlay.setSolidColor(mainTC);
mPlay.setTriangleColor(mainTC);
mProgress.setBackgroundColor(accentC);
ColorDrawable cd = new ColorDrawable(vicBC);
cd.setAlpha(200);
mProgressBG.setBackground(cd);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mShowList.getDrawable().setTint(mainTC);
}
}
示例4: showDetailDialog
import android.graphics.drawable.ColorDrawable; //导入方法依赖的package包/类
public static void showDetailDialog(Activity activity, SongInfo info) {
DialogProvider manager = new DialogProvider(activity);
String[] infos = new String[7];
infos[0] = "歌曲:" + info.getTitle();
infos[1] = "歌手:" + info.getArtist();
infos[2] = "专辑:" + info.getAlbum();
infos[3] = "时长:" + StringUtils.getGenTimeMS((int) info.getDuration());
infos[4] = "格式:" + info.getMime_type();
infos[5] = "大小:" + String.valueOf(info.getSize() >> 10 >> 10) + " MB";
infos[6] = "路径:" + info.getData();
View view = activity.getLayoutInflater().inflate(R.layout.list_image, null);
ListView listView = (ListView) view.findViewById(R.id.list_image_list);
ImageView imageView = (ImageView) view.findViewById(R.id.list_image_image);
listView.setAdapter(new ArrayAdapter<String>(
activity,
R.layout.text_view_start,
infos
));
Bitmap b = BitmapUtils.bitmapResizeFromFile(
info.getAlbum_path(),
imageView.getWidth(),
imageView.getHeight());
if (b == null) {
b = BitmapUtils.getDefaultPictureForAlbum(activity, imageView.getWidth(), imageView.getHeight());
}
if (b != null) {
imageView.setImageBitmap(b);
}
ColorDrawable drawable = new ColorDrawable(Color.WHITE);
drawable.setAlpha(245);
listView.setBackground(drawable);
manager.createFullyCustomDialog(view, "歌曲信息").show();
}
示例5: resetDefaultBackgroundAndTextColor
import android.graphics.drawable.ColorDrawable; //导入方法依赖的package包/类
/**
* 重置背景和文字颜色
*/
public void resetDefaultBackgroundAndTextColor() {
defaultTextColor = Color.WHITE;
defaultBackgroundColor = new ColorDrawable(Color.BLACK);
defaultBackgroundColor.setAlpha(200);
defaultBackgroundResid = null;
}
示例6: SlideFinishLayout
import android.graphics.drawable.ColorDrawable; //导入方法依赖的package包/类
public SlideFinishLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mEdgeSlop = ViewConfiguration.get(context).getScaledEdgeSlop();
mScroller = new Scroller(context);
if (context instanceof Activity) {
window = ((Activity) context).getWindow();
backDrawable = new ColorDrawable(getResources().getColor(R.color.black));
backDrawable.setAlpha((int) (255 * 0.4));
window.setBackgroundDrawable(backDrawable);
}
this.setBackgroundResource(R.color.white);
}
示例7: updateColors
import android.graphics.drawable.ColorDrawable; //导入方法依赖的package包/类
public void updateColors(int color, boolean isVarying) {
ColorDrawable bd = new ColorDrawable(color);
bd.setAlpha(100);
mListTitleContainer.setBackground(bd);
int colorA = ColorUtils.setAlphaComponent(color, 235);
mViewRoot.setCardBackgroundColor(colorA);
ThemeEnum t;
if (com.duan.musicoco.util.ColorUtils.isBrightSeriesColor(colorA)) {
t = WHITE;
} else {
t = DARK;
}
int cs[];
switch (t) {
case WHITE: {
if (isVarying) {
cs = com.duan.musicoco.util.ColorUtils.get2ColorWhiteThemeForPlayOptions(activity);
} else {
cs = com.duan.musicoco.util.ColorUtils.get2WhiteThemeTextColor(activity);
}
break;
}
case DARK:
default: {
if (isVarying) {
cs = com.duan.musicoco.util.ColorUtils.get2ColorDarkThemeForPlayOptions(activity);
} else {
cs = com.duan.musicoco.util.ColorUtils.get2DarkThemeTextColor(activity);
}
break;
}
}
songOption.setDrawableColor(cs[0]);
listOption.setDrawableColor(cs[0]);
if (playListAdapter != null) {
playListAdapter.setMainTextColor(cs[0]);
playListAdapter.setVicTextColor(cs[1]);
}
listOption.updateColors();
songOption.updateColors();
}
示例8: setDefaultBackgroundColor
import android.graphics.drawable.ColorDrawable; //导入方法依赖的package包/类
/**
* 设置默认背景颜色
*
* @param color 颜色值
* @param alpha 透明度
*/
public void setDefaultBackgroundColor(int color, Integer alpha) {
defaultBackgroundColor = new ColorDrawable(color);
if (alpha != null) defaultBackgroundColor.setAlpha(alpha);
defaultBackgroundResid = null;
}