2011-07-27 5 views
0

환경 설정을 확장하는 사용자 정의 클래스를 만들었습니다. 필자는 XML 레이아웃 파일에서 해당 사용자 정의 클래스를 사용하여 그 값에 액세스해야합니다. 내 레이아웃 파일의 부분 :layout.filename에서 UI 요소 값에 액세스하는 방법

<MyCustomClass 
android:id="@+id/custom01" 
android:title="ineedthistext" /> 

가 어떻게 문자열로 "ineedthistext"를 검색 할 수 있습니다? 클래스 생성자 통해

답변

0

:

public MyCustomClass(Context context, AttributeSet attrs) { 
    ... 
    // Get an attribute 
    X var = attrs.getX(...); 
} 
관련 문제