Back to project page bbstalker.
The source code is released under:
GNU General Public License
If you think the Android project bbstalker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package yuku.ambilwarna.widget; /*from w w w . ja va 2 s .c om*/ import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.Style; import android.util.AttributeSet; import android.util.FloatMath; import android.view.View; public class AmbilWarnaPrefWidgetView extends View { Paint paint; float rectSize; float strokeWidth; public AmbilWarnaPrefWidgetView(Context context, AttributeSet attrs) { super(context, attrs); float density = context.getResources().getDisplayMetrics().density; rectSize = FloatMath.floor(24.f * density + 0.5f); strokeWidth = FloatMath.floor(1.f * density + 0.5f); paint = new Paint(); paint.setColor(0xffffffff); paint.setStyle(Style.STROKE); paint.setStrokeWidth(strokeWidth); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawRect(strokeWidth, strokeWidth, rectSize - strokeWidth, rectSize - strokeWidth, paint); } }