Sto utilizzando il pulsante di azione mobile di Android Design Library nella mia app che funziona perfettamente con lollipop e versioni precedenti ma si arresta in modo anomalo sulla versione pre-lecca-lecca (4.0-4.2.2). Sono davvero bloccato e incapace di capire il problema.Pulsante flottante non funzionante in versione lecca-lecca
Errore:
FATAL EXCEPTION: main android.view.InflateException: Binary XML file line #396: Error inflating class android.support.design.widget.FloatingActionButton at android.view.LayoutInflater.createView(LayoutInflater.java:619) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693) at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at com.example.sony.bluedolphintrialapp.DhampureFragment.onCreateView(DhampureFragment.java:18) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955) android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138 android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:458) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5279) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:593) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693) at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at com.example.sony.bluedolphintrialapp.DhampureFragment.onCreateView(DhampureFragment.java:18) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:458) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5279) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method) Caused by: android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x1/d=0x7f0b0008 a=-1 r=0x7f0b0008}
android.content.res.Resources.loadColorStateList(Resources.java:2963) at android.content.res.TypedArray.getColorStateList(TypedArray.java:343) at android.support.design.widget.FloatingActionButton.(FloatingActionButton.java:8 at android.support.design.widget.FloatingActionButton.(FloatingActionButton.java:77)
XML con tasto di azione flottante:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorLayout_signup"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.sony.bluedolphintrialapp.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/headerlayout"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:background="@color/backgroud_user"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:id="@+id/headertextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:text="@string/title"
android:textColor="#FFF"
android:textSize="22dp" />
</RelativeLayout>
<com.gc.materialdesign.views.ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/headerlayout"
android:background="#F2F5F6">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="0sp"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:paddingBottom="60dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:stretchColumns="0">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:weightSum="1">
<TextView
android:id="@+id/currentlyEmployed_label"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_weight=".4"
android:padding="5dp"
android:textSize="15sp"
android:text="Channel Partner :"
android:textColor="@android:color/black" />
<com.gc.materialdesign.NewMaterials.Spinner
android:id="@+id/currentlyEmployed_spinner_id"
style="@style/Material.Widget.Spinner.Light"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight=".6"
app:rd_style="@style/Material.Drawable.Ripple.Wave.Light"
app:rd_enable="true"
app:rd_delayClick="false"
app:spn_labelEnable="true"
app:spn_label="Select"
app:spn_arrowSwitchMode="true"
android:padding="5dp"
app:spn_arrowAnimDuration="@android:integer/config_shortAnimTime"
app:spn_arrowInterpolator="@android:anim/decelerate_interpolator"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:weightSum="0.5">
<android.support.design.widget.TextInputLayout
android:id="@+id/signup_first_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:theme="@style/TextLabel"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/addplaces_name"
android:layout_width="match_parent"
android:drawableLeft="@drawable/ic_action_person1"
android:drawableStart="@drawable/ic_action_person1"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:paddingLeft="3dp"
android:paddingStart="3dp"
android:paddingRight="3dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:hint="Name"
android:inputType="textPersonName" />
</android.support.design.widget.TextInputLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="1dp"
android:weightSum="0.5">
<android.support.design.widget.TextInputLayout
android:id="@+id/Adress_first_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:padding="3dp"
android:theme="@style/TextLabel"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/adress_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_action_time"
android:drawableStart="@drawable/ic_action_time"
android:layout_alignParentTop="true"
android:paddingLeft="3dp"
android:paddingStart="3dp"
android:paddingRight="3dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:hint="Start Time"
android:inputType="time|datetime" />
</android.support.design.widget.TextInputLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="2dp"
android:weightSum="0.5">
<android.support.design.widget.TextInputLayout
android:id="@+id/mobileNo_first_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:theme="@style/TextLabel"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/mobileNo_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_action_time"
android:drawableStart="@drawable/ic_action_time"
android:layout_alignParentTop="true"
android:paddingLeft="3dp"
android:paddingStart="3dp"
android:paddingRight="3dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:hint="End Time"
android:inputType="text|textPostalAddress" />
</android.support.design.widget.TextInputLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="2dp"
android:weightSum="0.5">
<android.support.design.widget.TextInputLayout
android:id="@+id/email_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:theme="@style/TextLabel"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/email_Text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_action_time"
android:layout_alignParentTop="true"
android:paddingLeft="3dp"
android:paddingStart="3dp"
android:paddingRight="3dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:hint="Actual Start Time"
android:inputType="text|textPostalAddress" />
</android.support.design.widget.TextInputLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="2dp"
android:weightSum="0.5">
<android.support.design.widget.TextInputLayout
android:id="@+id/notes_first_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:theme="@style/TextLabel"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/notes_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:drawableLeft="@drawable/ic_action_time"
android:paddingLeft="3dp"
android:paddingStart="3dp"
android:paddingRight="3dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:hint="Actual End Time"
android:inputType="text|textPostalAddress" />
</android.support.design.widget.TextInputLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="2dp"
android:weightSum="0.5">
<android.support.design.widget.TextInputLayout
android:id="@+id/variance_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="5dp"
android:theme="@style/TextLabel"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/variance_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:drawableLeft="@drawable/ic_action_error"
android:paddingLeft="3dp"
android:paddingStart="3dp"
android:paddingRight="3dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:drawablePadding="5dp"
android:hint="Variance"
android:inputType="text|textPostalAddress" />
</android.support.design.widget.TextInputLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="3dp"
android:weightSum="0.5">
<com.dd.CircularProgressButton
android:id="@+id/Button_id"
android:layout_width="0dp"
android:layout_height="50dp"
android:text="Start"
android:padding="5dp"
android:layout_weight=".5"
android:gravity="center|center_horizontal"
android:layout_below="@+id/personmobile_id"
android:layout_marginTop="7sp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:textSize="15sp"
android:textColor="#FFFFFF"
app:cpb_cornerRadius="100dp"
app:cpb_selectorComplete="@color/STOPbutton"
app:cpb_selectorIdle="@color/backgroud_user"
app:cpb_selectorError="@color/sienna"
app:cpb_textComplete="STOP"
app:cpb_textIdle="START"/>
</TableRow>
<TableRow
android:layout_width="20dp"
android:layout_height="0dp"
android:layout_marginBottom="3dp"
android:weightSum="0.5">
<TextView
android:id="@+id/timertext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:00"
android:textColor="?colorPrimary"
android:textStyle="bold"
android:layout_gravity="center"
android:textSize="25sp"
/>
</TableRow>
</TableLayout>
</RelativeLayout>
</com.gc.materialdesign.views.ScrollView>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
app:fab_iconSize="@dimen/fab_size_mini"
android:layout_margin="@dimen/fab_margin"
android:layout_gravity="end|bottom|right"
android:src="@drawable/ic_format_list_bulleted_white_48dp"
app:rippleColor="@android:color/white"
android:layout_alignParentBottom="true"
app:backgroundTint="@color/green_dark"
android:layout_centerHorizontal="true"
app:elevation="6dp"
app:pressedTranslationZ="25dp"/>
</android.support.design.widget.CoordinatorLayout>
qual è la vostra linea di 396? – justDroid
@justDroid è apparentemente il tag del pulsante mobile –
a causa di Causa di: android.content.res.Resources $ NotFoundException: Resource non è un ColorStateList. Può darsi che abbiate indicato un riferimento di risorsa sbagliato lì – justDroid