java类android.graphics.drawable.ColorDrawable的实例源码

ImgSelFragment.java 文件源码 项目:MyFire 阅读 27 收藏 0 点赞 0 评论 0
private void createPopupFolderList(int width, int height) {
    folderPopupWindow = new ListPopupWindow(getActivity());
    folderPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    folderPopupWindow.setAdapter(folderListAdapter);
    folderPopupWindow.setContentWidth(width);
    folderPopupWindow.setWidth(width);
    folderPopupWindow.setHeight(height);
    folderPopupWindow.setAnchorView(rlBottom);
    folderPopupWindow.setModal(true);
    folderListAdapter.setOnFloderChangeListener(new OnFolderChangeListener() {
        @Override
        public void onChange(int position, Folder folder) {
            folderPopupWindow.dismiss();
            if (position == 0) {
                getActivity().getSupportLoaderManager().restartLoader(LOADER_ALL, null, mLoaderCallback);
                btnAlbumSelected.setText("所有图片");
            } else {
                imageList.clear();
                if (config.needCamera)
                    imageList.add(new Image());
                imageList.addAll(folder.images);
                imageListAdapter.notifyDataSetChanged();

                btnAlbumSelected.setText(folder.name);
            }
        }
    });
}
QMUIRadiusImageView.java 文件源码 项目:qmui 阅读 32 收藏 0 点赞 0 评论 0
private Bitmap getBitmap() {
    Drawable drawable = getDrawable();
    if (drawable == null) {
        return null;
    }

    if (drawable instanceof BitmapDrawable) {
        return ((BitmapDrawable) drawable).getBitmap();
    }

    try {
        Bitmap bitmap;

        if (drawable instanceof ColorDrawable) {
            bitmap = Bitmap.createBitmap(COLOR_DRAWABLE_DIMEN, COLOR_DRAWABLE_DIMEN, BITMAP_CONFIG);
        } else {
            bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG);
        }

        Canvas canvas = new Canvas(bitmap);
        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        drawable.draw(canvas);
        return bitmap;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
IamDialog.java 文件源码 项目:android-mobile-engage-sdk 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void onStart() {
    super.onStart();

    getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    Window window = getDialog().getWindow();
    WindowManager.LayoutParams windowParams = window.getAttributes();
    windowParams.dimAmount = 0.0f;
    window.setAttributes(windowParams);

    getDialog().getWindow()
            .setLayout(WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.MATCH_PARENT);
}
AttackSettingActivity.java 文件源码 项目:SmingZZick_App 阅读 22 收藏 0 点赞 0 评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);


    int headTextColor;
    if (Build.VERSION.SDK_INT >= 23) {
        headTextColor = getResources().getColor(R.color.setup_item_head_text, null);
    } else {
        headTextColor = getResources().getColor(R.color.setup_item_head_text);
    }

    toolbar.setTitleTextColor(headTextColor);
    setSupportActionBar(toolbar);

    int headColor;
    if (Build.VERSION.SDK_INT >= 23) {
        headColor = getResources().getColor(R.color.setup_item_head, null);
    } else {
        headColor = getResources().getColor(R.color.setup_item_head);
    }

    getSupportActionBar().setTitle("총공 설정");
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(headColor));
    getFragmentManager().beginTransaction()
            .replace(R.id.frame, new AttackSettingFragment())
            .commit();
}
ChangeDateAndTimeTypeFragment.java 文件源码 项目:boohee_v5.6 阅读 22 收藏 0 点赞 0 评论 0
public void onStart() {
    super.onStart();
    Window window = getDialog().getWindow();
    LayoutParams params = window.getAttributes();
    params.gravity = 80;
    params.width = -1;
    params.height = DensityUtil.dip2px(getActivity(), 480.0f);
    window.setAttributes(params);
    window.setBackgroundDrawable(new ColorDrawable(0));
}
DrawableCrossFadeViewAnimationTest.java 文件源码 项目:GitHub 阅读 26 收藏 0 点赞 0 评论 0
@Test
public void testSetsTransitionDrawableIfPreviousIsNotNull() {
  Drawable previous = new ColorDrawable(Color.WHITE);
  when(harness.adapter.getCurrentDrawable()).thenReturn(previous);
  harness.animation.transition(harness.current, harness.adapter);

  verify(harness.adapter).setDrawable(any(TransitionDrawable.class));
}
AboutActivity.java 文件源码 项目:privacyidea-authenticator 阅读 25 收藏 0 点赞 0 评论 0
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(PIBLUE)));
    }
}
BubbleImageView.java 文件源码 项目:LQRWeChat 阅读 32 收藏 0 点赞 0 评论 0
private Bitmap getBitmapFromDrawable(Drawable drawable) {
    if (drawable == null) {
        return null;
    }

    if (drawable instanceof BitmapDrawable) {
        return ((BitmapDrawable) drawable).getBitmap();
    }

    try {
        Bitmap bitmap;

        if (drawable instanceof ColorDrawable) {
            bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION,
                    COLORDRAWABLE_DIMENSION, BITMAP_CONFIG);
        } else {
            bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
                    drawable.getIntrinsicHeight(), BITMAP_CONFIG);
        }

        Canvas canvas = new Canvas(bitmap);
        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        drawable.draw(canvas);
        return bitmap;
    } catch (OutOfMemoryError e) {
        return null;
    }
}
AssistantActivity.java 文件源码 项目:Linphone4Android 阅读 34 收藏 0 点赞 0 评论 0
public void displayRemoteProvisioningInProgressDialog() {
    remoteProvisioningInProgress = true;

    progress = ProgressDialog.show(this, null, null);
    Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorE));
    d.setAlpha(200);
    progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
    progress.getWindow().setBackgroundDrawable(d);
    progress.setContentView(R.layout.progress_dialog);
    progress.show();
}
PlayTopPopupWindow.java 文件源码 项目:CCDownload 阅读 22 收藏 0 点赞 0 评论 0
public PlayTopPopupWindow(Context context, int height) {
    this.context = context;
    View view = LayoutInflater.from(context).inflate(R.layout.play_top_menu, null);

    rgSubtitle = findById(R.id.rg_subtitle, view);
    rgScreenSize = findById(R.id.rg_screensize, view);

    popupWindow = new PopupWindow(view, height * 2 / 3, height);
    popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178, 0, 0, 0)));
}


问题


面经


文章

微信
公众号

扫码关注公众号