Binary XML file line #26: Error inflating class android.widget.TextView Binary XML file line #26: Error inflating class android.widget.TextView xml xml

Binary XML file line #26: Error inflating class android.widget.TextView


android:background="@drawable/offers"

i hope offers is image and its larger than the screen so replace by some color code n try

Like this

android:background="#ff0000"

hope it works..

check this too

android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>

edit:

remove this line

android:textAppearance="?android:attr/textAppearanceMedium"


I cleaned up your xml and added the namespace:

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="0dp"    android:layout_margin="10dp"    android:layout_weight="1"    android:background="@drawable/offers"    android:gravity="center_vertical|center_horizontal"    android:orientation="vertical" ><ImageView    android:id="@+id/imageButtonOffers"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:src="@drawable/offers_icon" /><TextView    android:id="@+id/textViewOffers"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:layout_marginTop="5dp"    android:gravity="center_horizontal"    android:text="Offer"    android:textAppearance="?android:attr/textAppearanceMedium"    android:textColor="@color/white"    android:textSize="15sp" /></LinearLayout>

As you are using a LinearLayout, parameters like "android:layout_below" or "android:layout_centerHorizontal" are not invalid.


I also encountered this error.

I solved it by simply recreating new .xml file containing TextView.In my case, the error was the xml version(v21\abc.xml).code run well in android version 6(marshmallow) rather than it throws error while run in android version 4.4(kitkat).