Ошибка надувания класса android.support.v7.widget.AppCompatImageButton
Мое приложение падает только на некоторых устройствах Android, с ошибкой инфляции относительно v7 AppCompatImageButton. Поскольку эти кнопки работают нормально на большинстве устройств, на которых запущено мое приложение, у меня возникают проблемы с пониманием, почему они не надуваются должным образом на других (например, на Moto X).
Я изначально думал, что использование android:background="@android:color/transparent"
вместо явного цвета шестнадцатеричный код может вызывать проблему, но, увы, кнопка по-прежнему не может раздуваться, даже если я изменю этот атрибут на android:background="#00000000"
,
Может кто-нибудь предложить понимание того, что приводит к тому, что некоторые телефоны не могут надуть эту кнопку xml?
Раздувать код
public class FragmentEasyChordMenu extends Fragment implements EasyChordAdapter.onItemClickListener {
private static ImageButton mBtnAddMarker, mBtnRemoveMarker;
private View mPopupView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.menu_fragment_easychord, container, false);
LayoutInflater layoutInflater = (LayoutInflater)getActivity().getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPopupView = layoutInflater.inflate(R.layout.easy_chord_menu, null); //ERROR Here
...
}
}
<LinearLayout
android:layout_weight="0.5"
android:layout_width="0dp"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/removeMarker"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@android:color/transparent"
android:padding="16dp"
android:src="@drawable/ic_remove_circle_black_24dp"
android:tint="#C4252C"/>
</LinearLayout>
Полная трассировка стека:
FATAL EXCEPTION: main
Process: com.guitarsimtechnologies.guitarsim, PID: 10146
android.view.InflateException: Binary XML file line #0: Error inflating class android.support.v7.widget.AppCompatImageButton
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
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.rInflate(LayoutInflater.java:758)
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 android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.guitarsimtechnologies.guitarsim.FragmentEasyChordMenu.onCreateView(FragmentEasyChordMenu.java:79)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2343)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2199)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:651)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:145)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1236)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1084)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
at android.view.View.measure(View.java:16557)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5137)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16557)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1231)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:590)
at android.view.View.measure(View.java:16557)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5137)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16557)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5137)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16557)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5137)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16557)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5137)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
at android.view.View.measure(View.java:16557)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1942)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1132)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1321)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java: