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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:28:36+00:00 2026-05-24T00:28:36+00:00

Scope : – using overriden ArrayAdapter; – using selector; – using isEnabled for disabling

  • 0

Scope:
– using overriden ArrayAdapter;
– using selector;
– using isEnabled for disabling items.

Aim:
– disable some list items and load disabled state view via selector.

Problem:
– everything works (custom view, selector for unfocused, focuesd and pressed states) but disabled items don’t use selector for disabled state.

Investigating: when I use isEnabled for disabling some items in listview Hierarchy Viewer shows that disabled items are unfocusable, unclickable but(!) enabled.

Is it a bug or something is missing?

P.S. actually, docs say that isEnabled doesn’t do setEnabled(false) for list item, it makes it a divider(?) object.
P.P.S I also tried to use if-statement to set my View (in getView) as isEnabled(false). But it works only for focused items?

My Selector looks like:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Disabled -->
    <item 
        android:state_enabled="false"
        android:textColor="@color/greyDark"
        android:drawable="@drawable/list_item_disabled" />
    <!-- Pressed -->
    <item 
        android:state_enabled="true"
        android:state_pressed="true"
        android:textColor="@android:color/white"
        android:drawable="@drawable/list_item_pressed" />
    <!-- Focused -->
    <item
        android:state_enabled="true"
        android:state_focused="true"
        android:textColor="@android:color/white"
        android:drawable="@drawable/list_item_focused" />
    <!-- Default -->
    <item 
        android:state_enabled="true"
        android:drawable="@drawable/list_item_unfocused" />
</selector>
  • 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-05-24T00:28:37+00:00Added an answer on May 24, 2026 at 12:28 am

    Hack:
    use getView to check disabled item logic and inflate view with another layout. isEnabled is still usefull.

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View row;
    
        if (mListItem[position].isEnabled() == false) row = inflater.inflate(
                R.layout.list_row_disabled, null);
        else {
            row = inflater.inflate(R.layout.list_row, null);
            // set right extensible icon
            if (mListItem[position].getType()) {
                ImageView ic_arrow = (ImageView) row.findViewById(R.id.list_row_arrow);
                ic_arrow.setImageResource(R.drawable.ic_arrow_right);
            }
        }
        // set left icon
        ImageView ic_item = (ImageView) row.findViewById(R.id.list_row_icon);
        ic_item.setImageResource(mListItem[position].getIcon());
        // blend icon if item is disabled
        if (mListItem[position].isEnabled() == false) 
            ic_item.setColorFilter(0x99D0D0D0,Mode.SRC_ATOP); // make icons look grayer 
    
        // set title text
        TextView txvTitle = (TextView) row.findViewById(R.id.list_row_title);
        txvTitle.setText(mListItem[position].getTitle());
    
        return row;
    }
    
    @Override
    public boolean isEnabled(int position) {
        return mListItem[position].isEnabled();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Ryan Bates' excellent scope_builder to conditionally build a new named scope to
I was wondering which scope to use for a CRUD Application. Using @ReqeustScoped causes
It's a visibility scope issue. Can I make the variables global? For some reason
Is there any scope problem in this program? #include<iostream> using namespace std; template<class Type>
I'm doing using(var scope = new TransactionScope()) { //lots of calls to sql server
Consider this example @Scope(ScopeType.SESSION) @Name(test) @BypassInterceptors public Class Test { @Unwrap public List<String> test()
Scope: PHP-mysql based site, using memcached. Caching issue is mostly about prices. Because of
using (TransactionScope scope = new TransactionScope()) using (var context = new dwfEntities()) { var
We are using Transaction Scope for performing transactions in .Net 3.0. How do I
I am using transaction scope. I want to have a transaction scope for 2

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.