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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:21:37+00:00 2026-05-26T08:21:37+00:00

because I need to display something more than just a list in a Fragment.

  • 0

because I need to display something more than just a list in a Fragment.
So I choose Fragment rather than ListFragment, and my layout is something looks like

<linearlayout...>
    <TextView...>...<TextView/>
    <Button...>...<Button/>
    <ListView android:id = "@"+id/mylist" ...></ListView>
</linearylayout>

And I implemnt “MyAdapter” extend BaseAdapter, which has getView like following

@Override
public View getView(int position, View convertView, ViewGroup parent) 
{
    if(position == 0)
    {
        return categroyView("Team leader");
    }
    else if (position == 2)
    {
        return categroyView("Team memebers");
    }
    else
    {
        LayoutInflater inflater = context.getLayoutInflater();
        View v = inflater.inflate(R.layout.row_group, null, false);
        return v;
    }
}


protected View categroyView(String text)
{
    TextView txtView = new TextView(context);
    txtView.setText(text);
    return txtView;
}

It turns out that I can receive onItemClick when its position is 0 or 2 (which as you can see I dynamically generate textView.
Meanwhile I can’t receive onItemClick when its position is not 0 or 2 (which I return inflate view from XML)

I’ve seen some discussion about if customized row layout has some clickable item (like button), this situation will happen, but even my row layout has only one textView, it still failed to receive onItemClick.

p.s.

  1. Also, I select Fragment rather than Activity for other other design issue.
  2. I know I can alternatively add v.setOnClickListene in getView to help this issue, but then still the item won’t highlight if I pressed on it.
  • 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-26T08:21:37+00:00Added an answer on May 26, 2026 at 8:21 am

    What is in the position two view? If that thing might be able to take focus sit will do it instead of the list item if you don’t want the inards to be clickabke then disable that it’s click and it will the be passed to the item

    Also are these long lists? You will run into trouble if you inflate a lot

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

Sidebar

Related Questions

I feel like there's something rather basic I'm missing here, which I previously thought
I'm trying to use QGLbuffer to display an image. Sequence is something like: initializeGL()
I need to use deprecated stop () because I need to run Runnable classes
I need to fetch only first record (because I need last date) of resultset,
I am overriding sessionscontroller because I need a special behavior. When the user signs
Problem: I need to write/read objects from a file.This because I need to write/read
I need single-producer, single-consumer FIFO query because I need to process messages in the
Edit: The reason queue is 2d is because I need a pointer of Command
I am using a custom TreeView class because i need drag-and-drop capabilities. I am
I want to use MAF in my project because I need a robust add-in

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.