FlatUI.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:NyaungUConverter 作者:
/**
 * Returns a suitable drawable for ActionBar with theme colors.
 *
 * @param theme        selected theme
 * @param dark         boolean for choosing dark colors or primary colors
 * @param borderBottom bottom border width
 * @return drawable to be used in ActionBar
 */
public static Drawable getActionBarDrawable(Activity activity, int theme, boolean dark, float borderBottom) {
    int[] colors = activity.getResources().getIntArray(theme);

    int color1 = colors[2];
    int color2 = colors[1];

    if (dark) {
        color1 = colors[1];
        color2 = colors[0];
    }

    borderBottom = dipToPx(activity, borderBottom);

    PaintDrawable front = new PaintDrawable(color1);
    PaintDrawable bottom = new PaintDrawable(color2);
    Drawable[] d = {bottom, front};
    LayerDrawable drawable = new LayerDrawable(d);
    drawable.setLayerInset(1, 0, 0, 0, (int) borderBottom);
    return drawable;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号