내 응용 프로그램에서 사용하려고하는 사용자 정의보기 (GLSurfaceView를 확장)가 있습니다. 그것을 사용하는 xml 레이아웃이 올바르게로드 된 것 같습니다 (뷰에 설정된 속성이 적용됨). 그러나 뷰 생성자 나 onFinishInflate 메소드가 클래스에 대해 호출되지 않습니다. 나는 또한 안드로이드 플랫폼을 처음 사용한다고 덧붙여 야한다. 그래서 이것은 아마 어리석은 실수 일 것이다.생성자 또는 onFinishInflate가 사용자 정의보기를 호출하지 않았습니다.
여기
#<!-- Status Bar -->
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@drawable/status_bkg">
#<!-- Location label -->
<TextView
android:text="Location"
android:textColor="#FFFFFF"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
#<!-- Date/Time label -->
<TextView
android:text="Date and Time"
android:textColor="#FFFFFF"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right" />
</LinearLayout>
#<!-- ChartView -->
<View class="com.xxx.yyy.ChartView" android:id="@+id/chartView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FF00"
android:layout_weight="1">
</View>
ChartView 사용자 정의 GLSurfaceView입니다
<?xml version="1.0" encoding="utf-8"?>
내 main.xml에
입니다. 이 레이아웃이로드되고 ChartView는 지정된 녹색 배경을가집니다. 그러나, 아무 것도 내 설정 (코드에서) 그것을 위해 발생합니다. 두 생성자와 onFinishInflate 메서드에 배치하려고 시도했지만 설명 할 수 없게 호출되지 않습니다. 내가 클래스 이름이 올바른지 확인한합니다 (xxx.yyy이 게시물에 회사를 숨기기 위해 단지이다.
나는 또한 XML을 참조
<com.xxx.yyy.ChartView android:id="@+id/chartView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FF00"
android:layout_weight="1"/>
의 다른 형태로 시도했다 그러나이 죽는 활동을로드하는 것은 (내 코드에서 확실히 있지만) 생성자
ChartView (컨텍스트 컨텍스트의 AttributeSet attrs에가) 가
가 존재하지 않는
것을 말할 때.누구나 무슨 일이 벌어 질지에 대한 조언을 얻었습니까?
보기의 Java 코드를 붙여 넣습니다. – Cristian