private void initColorLayout() {
float width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, getContext().getResources().getDisplayMetrics());
mColorLayout.removeAllViews();
for(int i = 0, size = colors.length; i < size; i ++) {
ShapeDrawable shapeDrawable = new ShapeDrawable(new OvalShape());
shapeDrawable.setBounds(0, 0, (int) width, (int) width);
shapeDrawable.getPaint().setColor(colors[i]);
View view = new View(getContext());
view.setBackgroundDrawable(shapeDrawable);
view.setTag(colors[i]);
view.setOnClickListener(new ColorItemClickListener());
MarginLayoutParams layoutParams = new LayoutParams((int) width, (int) width);
layoutParams.setMargins((int) (width / 8), 0, (int) (width / 8), 0);
mColorLayout.addView(view, layoutParams);
}
}
CustomSettingView.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:MusicUU
作者:
评论列表
文章目录