CostumeCheckBox를 만들기 위해 ImageView의 중간에 rect를 그려야합니다. 임 안드로이드에서 새로운 나는 이것을 할 생각이 없습니다. 이미지 뷰/CostumeCheckbox는 국경이 있습니다Android : ImageView에서 rect를 그리는 방법
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"
android:gravity="center" >
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
참고 slimier 질문에 대한 내 대답을 확인하십시오 :
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Rect rect = new Rect();
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setColor(CheckboxBorderColor);
paint.setStrokeWidth(borderWidth);
getLocalVisibleRect(rect);
canvas.drawRect(rect, paint); }
이 목적을 위해 사용자 정의를 만들 필요가 없습니다. 정확히하고 싶은게 뭐야? 당신의 이미지에 체크 박스가 필요합니까? –