2011-11-19 3 views
0

두 개의 이미지보기가 포함 된 XML 파일을 만들었습니다. 각 뷰의 중앙에 서로 다른 두 개의 원 (다른 크기, 색)을 그립니다. 어떻게해야합니까, 특히 좌표. 감사!다른 모양으로 여러 모양 그리기

답변

0

당신이 shape Drawables ...

를 사용하여 귀하의 Drawable 폴더에 circle.xml을 만드는 것이 할 수있는 ...

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> 
    <solid android:color="@android:color/transparent"/> 
    <corners android:radius="12px"/> 
    <stroke android:width="2dp" android:color="#000000"/> 

</shape> 

ImageView

<ImageView android:id="@+id/circleimage" 
android:layout_height="150dp" 
android:layout_width="150dp" 
android:src="@drawable/circle"> 
</ImageView> 

당신이 사용할 수있는이 원에서 사용 하나 이상의 imageViews에 대해 .xml ...

0

ImageView의 하위 클래스를 만듭니다. XML에서 해당 서브 클래스를 사용하십시오. 그런 다음 덮어 쓰기

public void draw(Canvas canvas){ 
     super.draw(canvas); 
     // do your drawing here 
     // canvas holds the drawable area 
     // use canvas.drawXXXX methods with basic mathematics to put circles in places you need 
    } 

희망 사항.이 질문에 대한 답변입니다.

관련 문제