Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8755289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:49:33+00:00 2026-06-13T13:49:33+00:00

I have extended a TextView to also implement Checkable . I have not touched

  • 0

I have extended a TextView to also implement Checkable. I have not touched any TextView stuff, except for onCreateDrawableState. Furthermore, I just implemented the Checkable methods. (abridged for clarity.)

public class CheckableTextView extends TextView implements Checkable {

public CheckableTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
}

@Override
protected int[] onCreateDrawableState(int extraSpace) {
    final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
    if (isChecked()) {
        mergeDrawableStates(drawableState, CheckedStateSet);
    }
    return drawableState;
}

It compiles fine on ICS, but in Android 2.3 I get a pretty weird error when the program tried to inflate this view.

10-31 00:51:20.414: E/AndroidRuntime(601): FATAL EXCEPTION: main
10-31 00:51:20.414: E/AndroidRuntime(601): android.view.InflateException: Binary XML file line #3: Error inflating class net.blackenvelope.utrechtafval.map.layouts.CheckableTextView

…

10-31 00:51:20.414: E/AndroidRuntime(601): Caused by: java.lang.reflect.InvocationTargetException
10-31 00:51:20.414: E/AndroidRuntime(601):  at java.lang.reflect.Constructor.constructNative(Native Method)
10-31 00:51:20.414: E/AndroidRuntime(601):  at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
10-31 00:51:20.414: E/AndroidRuntime(601):  at android.view.LayoutInflater.createView(LayoutInflater.java:505)
10-31 00:51:20.414: E/AndroidRuntime(601):  ... 45 more
10-31 00:51:20.414: E/AndroidRuntime(601): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2
10-31 00:51:20.414: E/AndroidRuntime(601):  at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
10-31 00:51:20.414: E/AndroidRuntime(601):  at android.view.View.<init>(View.java:1963)
10-31 00:51:20.414: E/AndroidRuntime(601):  at android.widget.TextView.<init>(TextView.java:344)
10-31 00:51:20.414: E/AndroidRuntime(601):  at android.widget.TextView.<init>(TextView.java:337)
10-31 00:51:20.414: E/AndroidRuntime(601):  at net.app.layouts.CheckableTextView.<init>(CheckableTextView.java:11)
10-31 00:51:20.414: E/AndroidRuntime(601):  ... 48 more

I can’t seem to find out what this type=0x2 means.

Here is the XML:

<?xml version="1.0" encoding="utf-8"?>

<app.CheckableTextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/overlay_type_title"
    android:layout_width="match_parent"
    android:background="@drawable/overlay_list_bg_selector"
    android:layout_height="wrap_content"
    android:drawableLeft="@drawable/overlay_list_icon"
    android:drawablePadding="10dp"
    android:gravity="center_vertical"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:paddingLeft="10dp"
    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
    android:textAppearance="?android:attr/textAppearanceListItemSmall" 
    >
</app.CheckableTextView>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:49:35+00:00Added an answer on June 13, 2026 at 1:49 pm

    ?android:attr/listPreferredItemPaddingLeft and ?android:attr/listPreferredItemPaddingRight are available only in API 14+ (ICS and later). Thus, it is not interpreting it as a dimension on API 9-10 (2.3).

    I would suggest using your own values. If you’re familiar with resource files, add a <dimen> attribute with a padding value similar to the one you’re seeing on ICS, then reference that.

    If you’re unfamiliar with custom XML values, have a look at the dimen documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have extended my entities to implement specific interfaces for its type. I am
I have extended a server control (not a user control) and put the code
I have extended the ViewPager class and implemented onPageChangeListener. I use this ViewPager in
I have an extended BaseAdapter that has LinearLayout children (an ImageView and a TextView
I have extended the RichTextBox control to implement much of the missing functionality provided
I have extended Ext.data.Operation to implement a custom commitRecords method. The Ext.data.Operation class is
I have extended org.eclipse.ui.editors.text.TextEditor to implement a custom editor. For this editor, I have
I have a very basic program which displays a standard Textview and a extended
Just wonder. I have extended javascript Array object using its prototype as follows: <html>
I have extended the Entity framework to implement an interface by adding to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.