-1
이 오류가 발생하며 수정 방법을 모르겠습니다. 나는 수색하고, 주제를 놓고 그것을 바꾸기 같이 해결책을, 찾아 냈다 복제품 라이브러리조차 아무것도 그것을 고치지 않았다!이 활동과 함께 Theme.AppCompat 테마 (또는 자손)를 사용해야합니다 (stackoverflow를 통해 해결되지 않음)
내 오류 :
내 매니페스트 :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="SLUITEN" />
</intent-filter>
</activity>
<activity
android:name=".CustomSettings"
android:label="@string/title_activity_custom_settings"
android:theme="@style/AppTheme" />
<activity android:name=".aantekeningen.Aantekeningen" />
<activity
android:name="com.example.avjindersinghsekhon.minimaltodo.MainActivity"
android:theme="@style/AppThemed"
android:launchMode="singleTop"
android:screenOrientation="portrait"
/>
<activity android:name="com.example.avjindersinghsekhon.minimaltodo.AddToDoActivity"
android:screenOrientation="portrait"
android:parentActivityName="com.example.avjindersinghsekhon.minimaltodo.MainActivity"
/>
<activity android:name="com.example.avjindersinghsekhon.minimaltodo.AboutActivity"
android:label="@string/app_name"
android:parentActivityName="com.example.avjindersinghsekhon.minimaltodo.MainActivity"
/>
<activity android:name="com.example.avjindersinghsekhon.minimaltodo.ReminderActivity"
android:label="@string/app_name"
/>
<service android:name="com.example.avjindersinghsekhon.minimaltodo.TodoNotificationService"
/>
<service android:name="com.example.avjindersinghsekhon.minimaltodo.DeleteNotificationService"
/>
<activity android:name="com.example.avjindersinghsekhon.minimaltodo.SettingsActivity"
android:parentActivityName="com.example.avjindersinghsekhon.minimaltodo.MainActivity"
/>
<receiver android:name=".ScheduleWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/schedule_widget_info" />
</receiver>
<activity
android:name=".CustomHours"
android:label="Aangepaste uren"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
</application>
</manifest>
내 레이아웃 XML 파일
<include layout="@layout/base_toolbar"/>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/myCoordinatorLayout"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent"
>
<LinearLayout
android:id="@+id/toDoEmptyView"
android:orientation="vertical"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@drawable/empty_view_bg"
android:layout_width="100dp"
android:layout_height="100dp" />
<TextView
android:text="@string/no_to_dos"
android:textColor="@color/secondary_text"
android:textSize="16sp"
android:paddingTop="4dp"
android:paddingBottom="8dp"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp"
android:elevation="0dp"
>
<include layout="@layout/base_toolbar"/>
</android.support.design.widget.AppBarLayout>
<!--<include layout="@layout/base_toolbar"/>-->
<!--</android.support.design.widget.AppBarLayout>-->
<com.example.avjindersinghsekhon.minimaltodo.RecyclerViewEmptySupport
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/toDoRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.design.widget.FloatingActionButton
android:src="@drawable/ic_add_white_24dp"
android:id="@+id/addToDoItemFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
app:layout_anchor="@id/myCoordinatorLayout"
app:layout_anchorGravity="bottom|right|end"
app:layout_behavior="com.example.avjindersinghsekhon.minimaltodo.ScrollingFABBehaviour"
/>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>
내 styles.xml
,<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppThemeGrey" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorGrey</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowActionBar">false</item>
</style>
<style name="MyRandomTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/amber</item>
<item name="colorPrimaryDark">@color/amberPressed</item>
<item name="colorAccent">@color/amber</item>
</style>
<style name="MyCustomTabLayout" parent="Widget.Design.TabLayout">
<item name="android:textColor">#ff9800</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="CustomStyle" parent="Theme.AppCompat.NoActionBar">
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorSwitchThumbNormal">@color/grey300</item>
<item name="android:colorForeground">@color/grey600</item>
</style>
<style name="CustomStyle.DarkTheme" parent="Theme.AppCompat">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorAccent">@color/amber</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorSwitchThumbNormal">@color/grey300</item>
<item name="android:colorForeground">@color/grey600</item>
</style>
<style name="PopupMenuLight" parent="Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">@android:color/black</item>
</style>
<style name="OverflowThreeDotsWhite" parent="Widget.AppCompat.Light.ActionButton.Overflow">
<item name="android:src">@drawable/ic_menu_overflow_light</item>
</style>
<style name="ToolBarTheme" parent="Widget.AppCompat.Toolbar">
<item name="titleTextAppearance">@style/ToolbarTitleTextAppearanceLight</item>
</style>
<style name="ToolbarTitleTextAppearanceLight" parent="Base.TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="ToolbarTitleTextAppearanceDark" parent="Base.TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/amber</item>
</style>
<style name="CustomStyle.LightTheme" parent="Theme.AppCompat.Light">
<item name="actionOverflowButtonStyle">@style/OverflowThreeDotsWhite</item>
<item name="toolbarStyle">@style/ToolBarTheme</item>
<item name="popupMenuStyle">@style/PopupMenuLight</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorSwitchThumbNormal">@color/grey300</item>
<item name="android:colorForeground">@color/grey600</item>
</style>
<style name="CustomToolbar" parent="Widget.AppCompat.ActionBar">
<item name="theme">@style/CustomToolbarTheme</item>
</style>
<style name="CustomToolbarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">@color/secondary_text</item>
</style>
<style name="CustomCheckbox" parent="Widget.AppCompat.CompoundButton.CheckBox">
<item name="android:button">@color/amber</item>
</style>
<style name="AppTheme.ToolBarPadding" parent="Theme.AppCompat.Light.NoActionBar">
<item name="toolbarStyle">@style/myToolBarStyle</item>
</style>
<style name="CustomDialog" parent="Base.Theme.AppCompat.Light.Dialog">
<item name="colorAccent">@color/colorPrimary</item>
</style>
<style name="CustomSwitch" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorSwitchThumbNormal">@color/amber</item>
<item name="android:colorForeground">@color/secondary_text</item>
</style>
<style name="myToolBarStyle" parent="@style/Widget.AppCompat.Toolbar">
<item name="android:paddingRight">32dp</item>
</style>
<style name="FloatingLabelTextAppearance" parent="TextAppearance.AppCompat">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="AppThemed" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="android:windowActionBar">false</item>
</style>
</resources>
편집 :
오류 시작 응용 프로그램 :
FATAL EXCEPTION: main
Process: com.company.app, PID: 31597
java.lang.IllegalStateException: View can not be anchored to the the parent CoordinatorLayout
at android.support.design.widget.CoordinatorLayout$LayoutParams.resolveAnchorView(CoordinatorLayout.java:2526)
at android.support.design.widget.CoordinatorLayout$LayoutParams.findAnchorView(CoordinatorLayout.java:2495)
at android.support.design.widget.CoordinatorLayout.prepareChildren(CoordinatorLayout.java:623)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:674)
at android.view.View.measure(View.java:17547)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
at android.view.View.measure(View.java:17547)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
at android.view.View.measure(View.java:17547)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
at android.view.View.measure(View.java:17547)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
at android.view.View.measure(View.java:17547)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
at android.view.View.measure(View.java:17547)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2615)
at android.view.View.measure(View.java:17547)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2015)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1173)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1379)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
미리보기 위의 테마를 설정 했는가를 감사했다. – Vucko
귀하의 안드로이드 지원 디자인 라이브러리 버전은 무엇입니까? –
또한 오류가 없습니다. 유일한 문제는 rendring 문제입니다. 자바 클래스에서 초기화 할 때 .. 해결 될 것입니다. 그냥 무시하십시오 .. –