Skip to content Skip to sidebar Skip to footer

Xamarin - Binary Xml File Line #1: Error Inflating Class

I am currently developing a small Android app in Xamarin, using C#. The following shows up when I run it on my emulator: This line of code is called when the first tab is selected

Solution 1:

Your done.xml is color state list but color state lists can not be used as backgrounds. You need to use state-list-drawable for background.

Here is the state-list-drawable version of your color state list:

<?xml version="1.0" encoding="UTF-8" ?><selectorxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:state_focused="true"><shapeandroid:shape="rectangle"><solidandroid:color="#ff2222ff" /></shape></item><itemandroid:state_pressed="true"android:state_enabled="false"><shapeandroid:shape="rectangle"><solidandroid:color="#ff4444ff" /></shape></item><itemandroid:state_enabled="false"><shapeandroid:shape="rectangle"><solidandroid:color="#ff000000" /></shape></item><item><shapeandroid:shape="rectangle"><solidandroid:color="#ff0000ff" /></shape></item></selector>

Put this into an xml file in your drawable file and make your layout button xml like this:

android:background="@drawable/done"

You can find similar question in this link: How to set custom button state background color?

Post a Comment for "Xamarin - Binary Xml File Line #1: Error Inflating Class "