public final class ProgressWidget extends LinearLayout {
<Default Constructors implemented> {
setOrientation(LinearLayout.VERTICAL);
inflate(context, R.layout.horizontal_progress, this);
}
@Override
protected void onFinishInflate() {
//Continue with rest of the logic.
}
}
R.layout.horizontal_progress has 35 lines.android.view.InflateException : 이진 XML 파일 라인 39 번 : ProgressWidget 클래스를 부 풀리는 중 오류가 발생했습니다.
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/progressTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_white_background"
android:gravity="center"
android:textColor="@color/light_black"
android:textSize="12sp"
android:fontFamily="roboto-regular"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:paddingLeft="2dp"
android:paddingRight="2dp" />
<SeekBar
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="@dimen/horizontal_progress_height"
android:indeterminate="false"
android:progressDrawable="@drawable/horizontal_progress"
android:gravity="center"
android:thumb="@null"
android:progress="0"
android:secondaryProgress="0"
android:max="100"
android:minHeight="@dimen/horizontal_progress_height"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:paddingLeft="2dp"
android:paddingRight="2dp" />
</merge>
R.drawable.horizontal_progress에는 36 개의 행이 있습니다.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<item android:id="@android:id/background">
<shape android:shape="rectangle" >
<corners android:radius="@dimen/horizontal_progress_radius" />
<gradient
android:startColor="@color/horizontal_progress_background"
android:endColor="@color/horizontal_progress_background"
android:angle="270"/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape android:shape="rectangle" >
<corners android:radius="@dimen/horizontal_progress_radius" />
<gradient
android:startColor="@android:color/white"
android:endColor="@android:color/white"
android:angle="270"/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle" >
<corners android:radius="@dimen/horizontal_progress_radius" />
<gradient
android:startColor="?android:attr/colorAccent"
android:endColor="?android:attr/colorAccent"
android:angle="270"
tools:ignore="NewApi"/>
</shape>
</clip>
</item>
</layer-list>
스택 추적의 마지막 세그먼트입니다.
에 의해 발생 : android.view.InflateException : 바이너리 XML 파일 라인 # 39 : 오류 팽창 클래스 ProgressWidget android.view.LayoutInflater.createViewFromTag에서 android.view.LayoutInflater.createView (LayoutInflater.java:620) 에서 (LayoutInflater.java:696) android.view.LayoutInflater.inflate에서 android.view.LayoutInflater.rInflate (LayoutInflater.java:758) 에서 android.view.LayoutInflater.rInflate (LayoutInflater.java:755) 에서 (위해 LayoutInflater. java : 462) android.view.LayoutInflater.inflate (LayoutInflater.java:397) android.view.LayoutInflater의 입니다. inflate (LayoutInflater.java:353) android.view.View.inflate (View.java:1746
모든 기능은 삼성 Galaxy S5 SM-G900A, Android 버전 5.0에서 작동합니다. Asus Nexus 7, Android 4.4.3에서 항상 위의 스택 추적과 충돌합니다.
이 ProgressWidget은 안드로이드 라이브러리 모듈의 재사용이 가능한 재사용 가능한 구성 요소이며 프로젝트 모듈과 함께 사용됩니다. 메인 프로젝트 모듈은 MinSDKVersion 16을 TargetSDKVersion 24까지 늘 처리 할 것으로 예상됩니다.
Tablet 장치에서만 충돌을 일으키는 원인이 될 수있는 포인터는 크게 감사하겠습니다.
나는 또 다른 문제가 있고, 둘 다 아마 관련된 추측하고있다. http://stackoverflow.com/questions/39173996/android-resolving-style-properties-and-attributes이 ProgressWidget을 라이브러리 모듈의 사용자 정의 위젯으로 생각해보십시오. 주 테마 모듈에서 테마를 해결하려고합니다. 실행 시간. 어쨌든, 나는 "attr/colorAccent"를 시도했지만 아무 소용이 없습니다. – AndroidRocks