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 8629601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:51:00+00:00 2026-06-12T08:51:00+00:00

I have a ListFragment with a custom ArrayAdapter where I am overiding getView() to

  • 0

I have a ListFragment with a custom ArrayAdapter where I am overiding getView() to provide a custom View for the list item.

private class DirListAdaptor extends ArrayAdapter<DirItem> {

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View aView = convertView;
        if (aView == null) {
            LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            // TODO: can we not access textViewResourceId?
            aView = vi.inflate(R.layout.dir_list_entry, parent, false);
        }
 etc...

Here is the dir_list_entry.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/listPreferredItemHeight"
            android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
            android:paddingRight="?android:attr/listPreferredItemPaddingRight">

<ImageView
    android:id="@+id/dir_list_icon"

    android:layout_width="wrap_content"
    android:layout_height="match_parent"

    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true"
    android:layout_marginRight="6dp"
    android:src="@drawable/ic_launcher"
    />

<TextView
    android:id="@+id/dir_list_details"

    android:textAppearance="?android:attr/textAppearanceListItem"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:layout_toRightOf="@id/dir_list_icon"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"

    android:singleLine="true"
    android:ellipsize="marquee"

    android:textSize="12sp"
    android:text="Details" />

<TextView
    android:id="@+id/dir_list_filename"

    android:textAppearance="?android:attr/textAppearanceListItem"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:layout_toRightOf="@id/dir_list_icon"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_above="@id/dir_list_details"
    android:layout_alignWithParentIfMissing="true"

    android:gravity="center_vertical"
    android:textSize="14sp"

    android:text="Filename"/>

</RelativeLayout>

The bizarre thing is this works fine on Android 4.1 emulator, but I get the following error on Android 2.3:

10-01 15:07:59.594: ERROR/AndroidRuntime(1003): FATAL EXCEPTION: main
    android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
    at android.view.LayoutInflater.createView(LayoutInflater.java:518)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at com.eveps.evepsdroid.ui.PhotoBrowserListFragment$DirListAdaptor.getView(PhotoBrowserListFragment.java:104)
    at android.widget.AbsListView.obtainView(AbsListView.java:1430)
    at android.widget.ListView.makeAndAddView(ListView.java:1745)
    at android.widget.ListView.fillDown(ListView.java:670)
    at android.widget.ListView.fillFromTop(ListView.java:727)
    at android.widget.ListView.layoutChildren(ListView.java:1598)
    at android.widget.AbsListView.onLayout(AbsListView.java:1260)
    at android.view.View.layout(View.java:7175)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7175)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7175)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7175)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7175)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
    at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1243)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1049)
    at android.view.View.layout(View.java:7175)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7175)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
    at android.view.View.layout(View.java:7175)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7175)
    at android.view.ViewRoot.performTraversals(ViewRoot.java:1140)
    at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
    at android.view.LayoutInflater.createView(LayoutInflater.java:505)
    ... 42 more
    Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2
    at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
    at android.view.View.<init>(View.java:1957)
    at android.view.View.<init>(View.java:1899)
    at android.view.ViewGroup.<init>(ViewGroup.java:286)
    at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
    ... 45 more

I’m using the Android Support library for fragment support obviously.

Seems to be a problem inflating the custom list view entry, something to do with a dimension – but why does it work on JellyBean? Has something changed in this area?

  • 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-12T08:51:01+00:00Added an answer on June 12, 2026 at 8:51 am

    You’re using attributes that don’t exist in Gingerbread. The following don’t exist:

    • listPreferredItemPaddingLeft
    • listPreferredItemPaddingRight
    • textAppearanceListItem

    You can double check an attribute’s existence by looking in your SDK folder under /platforms/android-version/data/res/values/attrs.xml.

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

Sidebar

Related Questions

I have crated a class which extends the ListFragment . I have one button
I have a SherlockListFragment in which I have a custom list item (checkbox, icon
I have a class that extends ListFragment, and it overrides the OnListItemClick method. I
I have a ListFragment whose list should diplay the Albums of the device and
My Custom Adapter that extends SimpleCursorAdapter for my ListFragment does not display the items
I have a fragment view that needs replacement with another fragment. When the ListFragment
I have a ListFragment populated from a Cursor. I have the list background set
I have a Fragment which extends ListFragment, this is added at runtime to a
I have a ListFragment with a custom ListAdapter that lazy loads images and displays
I have a ListFragment containing a list of Earthquake objects that populates using a

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.