PaletteGridAdapter.java 文件源码

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

项目:color-picker 作者:
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    View view = convertView;
    if (view == null)
    {
        /*
         * TODO: build the layout programmatically
*/
        view = mLayoutInflater.inflate(R.layout.org_dmfs_colorpickerdialog_palette_field, null);
    }

    // set the background to a colored circle
    // TODO: allow to customize the shape
    Shape shape = new ArcShape(0, 360);
    ShapeDrawable bg = new ShapeDrawable(shape);
    bg.getPaint().setColor(mPalette.colorAt(position));

    if (android.os.Build.VERSION.SDK_INT < 16)
    {
        view.setBackgroundDrawable(bg);
    }
    else
    {
        view.setBackground(bg);
    }

    return view;

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号