2012-07-03 5 views
0

나는 속도계와 비슷하게 보이는 사용자 정의보기가 있습니다.사용자 정의보기에 편집 문구 추가

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:slider="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

<com.mysite.view.SeekBar_Speedometer 
    android:id="@+id/slider" 
    slider:fill_clockwise_color="@color/lightgrey" 
    slider:fill_anticlockwise_color="@color/blue" 
    slider:fill_handle_color="@color/green" 
    slider:fill_handle_width="3" 
    slider:angle_start="120" 
    slider:angle_end="60" 
    slider:fill_start_angle="120" 
    slider:score_min="0" 
    slider:score_max="300" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 

</LinearLayout> 

나는 속도계의 중앙에 편집 문구를 추가하고 싶습니다.

텍스트를 캔버스에 그릴 수있는 것처럼 내보기에서와 같은 방식으로 편집 텍스트를 추가 할 수 있습니까? 나는 그렇게 생각하지 않는다!

질문 :이 편집 텍스트를 내 사용자 정의보기에 추가하려면 어떻게해야합니까? 사용자 정의 뷰 클래스 내부

답변

1

당신은 할 수 있습니다 :

EditText edit = new EditText(context); 
addView(edit); 

이 사용자 정의보기 반드시이 뷰 그룹 확장하려면 (의 LinearLayout, RelativeLayout의, ECC를 ..)

+0

얼마나 많은 일이 그것에서 변경하는 것입니다 뷰 그룹보기? – HGPB

+0

기본적으로 아무 것도 없습니다. 그것은 당신의 시야로 무엇을하고 있는지에 달려 있습니다. LinearLayout 또는 RelativeLayout을 확장하는 클래스를 변경하십시오. –

+0

아! 속도계는 단지 사라진다. onDraw가 다르게 작동하는 것처럼 보입니까? – HGPB

관련 문제