, поэтому я развиваюсь, и у меня появился перекрестный забой, и я не знаю, что с ним делать.Как обрабатывать android.view.inflateexception Бинарная строка XML-файла # 5
журнал кошка:
03-09 16:33:12.018 8201-8201/org.aron.modiryar E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: org.aron.modiryar, PID: 8201
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.aron.modiryar/org.aron.modiryar.MainActivity}: android.view.InflateException: Binary XML file line #5: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5135)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #5: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at `com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at org.aron.modiryar.fragment.MainMenu.onCreateView(MainMenu.java:41)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5241)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
и это мой андроид манифеста:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.aron.modiryar"
android:versionCode="1"
android:versionName="1.0" android:uiOptions="splitActionBarWhenNarrow">
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name"
android:theme="@style/AppBaseTheme" android:enabled="true" android:name=".system.Initialize"
android:uiOptions="splitActionBarWhenNarrow">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden"
android:uiOptions="splitActionBarWhenNarrow" >
<meta-data android:name="android.support.UI_OPTIONS"
android:value="splitActionBarWhenNarrow" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
и мой макет, который не может быть завышена, как это:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainmenulayer" android:layout_width="match_parent" android:layout_height="fill_parent" android:orientation="vertical" android:visibility="visible" style="@style/MainMenu">
<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_title_height" android:orientation="horizontal" style="@style/RowMenu">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_title_collect" style="@style/RowMenuTitleText" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_inbox">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="@dimen/main_menu_row_count_margin_left">
<LinearLayout android:id="@+id/total_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/TotalCount" android:orientation="horizontal"></LinearLayout>
<LinearLayout android:id="@+id/overdue_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/OverDueCount" android:visibility="invisible" android:orientation="horizontal"></LinearLayout>
</LinearLayout>
<org.aron.modiryar.view.TextView android:id="@+id/menu_inbox_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_inbox" style="@style/RowMenuText" />
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_inbox"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_title_height" android:orientation="horizontal" style="@style/RowMenu">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_title_focuse_on" style="@style/RowMenuTitleText" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_today">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="@dimen/main_menu_row_count_margin_left">
<LinearLayout android:id="@+id/total_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/TotalCount"></LinearLayout>
<LinearLayout android:id="@+id/overdue_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/OverDueCount" android:visibility="invisible"></LinearLayout>
</LinearLayout>
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_today" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_today"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_next_action">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="@dimen/main_menu_row_count_margin_left">
<LinearLayout android:id="@+id/total_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/TotalCount"></LinearLayout>
<LinearLayout android:id="@+id/overdue_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/OverDueCount" android:visibility="invisible"></LinearLayout>
</LinearLayout>
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_next_action" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_next"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_tomorrow">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="@dimen/main_menu_row_count_margin_left">
<LinearLayout android:id="@+id/total_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/TotalCount"></LinearLayout>
<LinearLayout android:id="@+id/overdue_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/OverDueCount" android:visibility="invisible"></LinearLayout>
</LinearLayout>
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_tomorrow" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_tomorrow"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_calendar">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="@dimen/main_menu_row_count_margin_left">
<LinearLayout android:id="@+id/total_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/TotalCount"></LinearLayout>
<LinearLayout android:id="@+id/overdue_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/OverDueCount" android:visibility="invisible"></LinearLayout>
</LinearLayout>
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_calendar" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_scheduled"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_someday">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="@dimen/main_menu_row_count_margin_left">
<LinearLayout android:id="@+id/total_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/TotalCount"></LinearLayout>
<LinearLayout android:id="@+id/overdue_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/OverDueCount" android:visibility="invisible"></LinearLayout>
</LinearLayout>
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_sameday" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_someday"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_waitingfor">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="@dimen/main_menu_row_count_margin_left">
<LinearLayout android:id="@+id/total_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/TotalCount"></LinearLayout>
<LinearLayout android:id="@+id/overdue_count" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/OverDueCount" android:visibility="invisible"></LinearLayout>
</LinearLayout>
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_waitingfor" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_waiting"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent" android:layout_height="@dimen/main_menu_divider_line_height" style="@style/MainMenuLine"/>
<LinearLayout android:layout_width="fill_parent" android:layout_height="@dimen/main_menu_divider_line_height" style="@style/MainMenuLineWhite"/>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_project">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_project" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_project"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_Goal">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_goal" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_goal"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_responsibility">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_responsibility" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_responsibility"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_vision">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_vision" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_inbox"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent" android:layout_height="@dimen/main_menu_divider_line_height" style="@style/MainMenuLine"/>
<LinearLayout android:layout_width="fill_parent" android:layout_height="@dimen/main_menu_divider_line_height" style="@style/MainMenuLineWhite"/>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_reference">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_reference" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_inbox"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_trash">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_trash" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_trash"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_done">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_done" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_trash"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_routine">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_routine" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_inbox"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_menu_row_height" android:orientation="horizontal" style="@style/RowMenu" android:id="@+id/menu_tags">
<org.aron.modiryar.view.TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/menu_tags" style="@style/RowMenuText"/>
<ImageView android:layout_width="@dimen/main_menu_row_icon_width" android:layout_height="@dimen/main_menu_row_icon_height" android:src="@drawable/home_tags"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
, как вы можете или не можете видеть, что есть некоторые linearlayouts
с одинаковыми идентификаторами, но я знаю то, что это не моя проблема. Настоящая проблема - это приложение работает на ранних версиях Android, но не на более высоких. , и я уже пробовал сменить целевой sdk в манифесте android.
так что я пропустлю, пожалуйста, помогите.
public class TextView extends android.widget.TextView {
public TextView(Context context) {
super(context);
this.setTypeface(Config.getDefaultTypeFace(context));
}
public TextView(Context context, AttributeSet attrs) {
super(context, attrs);
this.setTypeface(Config.getDefaultTypeFace(context));
}
public TextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.setTypeface(Config.getDefaultTypeFace(context));
}
}
беспорядок, который вы видите, находится в макете, и моя проблема должна быть где-то там, поэтому я не могу удалить ее часть. – pouya
Мои макеты полностью с отступом. Во всяком случае, ** этот компонент выглядит очень подозрительно, для меня: 'org.aron.modiryar.view.TextView' –
Я проверил его, прежде чем кажется, что в нем нет проблем, но теперь я добавлю код. – pouya