android - After adding the MediaRouteButton my App crashes -
i have strange issues:
i added mediaroutebutton in layout
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/group_right" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignparentright="true" android:orientation="horizontal" > <linearlayout android:id="@+id/right_btns" android:layout_width="wrap_content" android:layout_height="match_parent" android:minwidth="@dimen/actionbar_icon_width" android:orientation="horizontal" > </linearlayout> <android.support.v7.app.mediaroutebutton android:id="@+id/media_route_button" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </linearlayout>
it works fine on newer devices. older devices 3.1, 2.3 or lower i'm getting exception
caused by: android.view.inflateexception: binary xml file line #74: error inflating class android.support.v7.app.mediaroutebutton @ android.view.layoutinflater.createview(layoutinflater.java:596) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:671) @ android.view.layoutinflater.rinflate(layoutinflater.java:724) @ android.view.layoutinflater.rinflate(layoutinflater.java:727) @ android.view.layoutinflater.inflate(layoutinflater.java:479) @ android.view.layoutinflater.inflate(layoutinflater.java:391) @ android.view.layoutinflater.inflate(layoutinflater.java:347) @ de.myapp.views.myactionbar.<init>(myactionbar.java:54) ... 36 more caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.constructnative(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:416) @ android.view.layoutinflater.createview(layoutinflater.java:576) ... 43 more caused by: android.content.res.resources$notfoundexception: resource not drawable (color or path): typedvalue{t=0x2/d=0x7f01000c a=3} @ android.content.res.resources.loaddrawable(resources.java:1841) @ android.content.res.typedarray.getdrawable(typedarray.java:601) @ android.view.view.<init>(view.java:2462) @ android.support.v7.app.mediaroutebutton.<init>(mediaroutebutton.java:121) @ android.support.v7.app.mediaroutebutton.<init>(mediaroutebutton.java:117) ... 46 more
in code happens when inflate xml layout
public myactionbar(context context, attributeset attrs) { super(context, attrs); inflate(context, r.layout.group_action_bar, this); titlegroup = (viewgroup) findviewbyid(r.id.group_title); leftbtngroup = (viewgroup) findviewbyid(r.id.left_btns); rightbtngroup = (viewgroup) findviewbyid(r.id.right_btns); titleappendix = findviewbyid(r.id.group_title_appendix); }
does know why doesn't work older devices lower api-level?
thanks!!!
i resolved myself
the problem drawable/list_selector_background.xml
on pre-ics devices selector has different implementation. not reach code of support-v7-lib. settings background of mediaroutebutton transparent worked out me.
<android.support.v7.app.mediaroutebutton android:id="@+id/media_route_button" android:layout_width="wrap_content" android:background="@android:color/transparent" android:layout_height="wrap_content"/>
Comments
Post a Comment