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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:12:09+00:00 2026-06-17T19:12:09+00:00

i am trying to implement listView through setListAdapter and Efficient Adapter. I want that

  • 0

i am trying to implement listView through setListAdapter and Efficient Adapter. I want that when list is show then the background should not be repeat. My code is repeating the whole layout of list.xml due to which my list item are showing with so much gap.

Right now my list is working like that:

enter image description here

But i want this type of view:

enter image description here

Here is my editText.xml in which i type the word and a list View is opened.

<EditText
    android:id="@+id/start_edit"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_gravity="top|left"
    android:ems="10"
    android:hint="Type to search"
    android:paddingLeft="50dp" >

    <requestFocus />
</EditText>

this layout is for list.xml :

<RelativeLayout
    android:id="@+id/RelativeLayout_list"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/blue_cellbar" >  

the list.xml file is repeating the layout in Effecient adapter:

here is my code:

listAdapter = new EfficientAdapter2(this);
    setListAdapter(listAdapter);



public static class viewHolder2 {
    TextView word;
    TextView meaning;
    ImageView image;
    ImageView image_color;
    RelativeLayout cell;

}



private class EfficientAdapter2 extends BaseAdapter implements Filterable,OnItemClickListener {

    private Context context;
    LayoutInflater inflater;

    public EfficientAdapter2(Context context) {

        this.context = context;
        inflater = LayoutInflater.from(context);

    }

    public int getCount() {


        //  if(SearchWordString.isEmpty()==false)
        //  {

        return SearchWordString.size();
        /// }

        //return 0;
    }

    public Object getItem(int position) {

        return position;
    }

    public long getItemId(int position) {

        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        viewHolder2 holder;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.list, null);

            ViewToUse=parent;
            holder = new viewHolder2();
            //  Log.i("View","is Null");
            convertView.setTag(holder);

        } else {

            //Log.i("View","is not Null");
            holder = (viewHolder2) convertView.getTag();
        }


        holder.cell = (RelativeLayout) convertView
                .findViewById(R.id.RelativeLayout_list);

        return convertView;
    }

UPDATE

public class Start extends ListActivity implements OnTouchListener,

android.view.GestureDetector.OnGestureListener {

// ////////////////////////////////////////////////////
/************* INNER CLASS VIEWHOLDER ****************/
// ////////////////////////////////////////////////////
onCreate()
{
ListView list_to_use = getListView();
listAdapter = new EfficientAdapter2(this);
list_to_use.setAdapter(listAdapter);
list_to_use.setBackgroundColor(2);
viewFlipper = (ViewFlipper) findViewById(R.id.viewFlipper1);

    search = (EditText) findViewById(R.id.start_edit);

    search.addTextChangedListener(myTextWatcher);

}
public static class viewHolder2 {
TextView word;
TextView meaning;
ImageView image;
ImageView image_color;
RelativeLayout cell;

}

// ////////////////////////////////////////////////////
/*********** INNER CLASS EfficientAdapter ************/
// ////////////////////////////////////////////////////

private class EfficientAdapter2 extends BaseAdapter implements Filterable,OnItemClickListener {

    private Context context;
    LayoutInflater inflater;

    public EfficientAdapter2(Context context) {

        this.context = context;
        inflater = LayoutInflater.from(context);

    }

    public int getCount() {


        //  if(SearchWordString.isEmpty()==false)
        //  {

        return SearchWordString.size();
        /// }

        //return 0;
    }

    public Object getItem(int position) {

        return position;
    }

    public long getItemId(int position) {

        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        viewHolder2 holder;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.list_search_item, null);

            ViewToUse=parent;
            holder = new viewHolder2();
            //  Log.i("View","is Null");
            convertView.setTag(holder);

            holder.word = (TextView) convertView.findViewById(R.id.title_list);
            holder.meaning = (TextView) convertView
                    .findViewById(R.id.textView_meaning_list);
            holder.image = (ImageView) convertView
                    .findViewById(R.id.image_list);
            holder.image_color = (ImageView) convertView
                    .findViewById(R.id.imageView_color_list);
            holder.cell = (RelativeLayout) convertView
                    .findViewById(R.id.RelativeLayout_list);

        } else {

            //Log.i("View","is not Null");

            holder = (viewHolder2) convertView.getTag();
        }

}
}

main.xml:

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

<EditText
    android:id="@+id/start_edit"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_gravity="top|left"
    android:ems="10"
    android:hint="Type to search"
    android:paddingLeft="50dp" >

    <requestFocus />
</EditText>

<ViewFlipper
    android:id="@+id/viewFlipper1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="top|left"
    android:layout_marginTop="50dp" >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ListView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/blue_home"
            android:fastScrollEnabled="true"
            android:smoothScrollbar="true"
            android:divider="@drawable/blue_dic"
            android:dividerHeight="250sp" >

        </ListView>

    </FrameLayout>

</ViewFlipper>

rows for listView:

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

<ImageView
    android:id="@+id/image_list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/abacus_thumbnail"
    android:scaleType="centerCrop" />

<ImageView
    android:id="@+id/imageView_color_list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/blue_thumbnail" />

<TextView
    android:id="@+id/title_list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/image_list"
    android:layout_marginLeft="20dp"
    android:layout_toRightOf="@+id/image_list"
    android:gravity="center"
    android:text="Abacus"
    android:textColor="#000000"
    android:textSize="30sp"
    android:textStyle="bold"
    android:typeface="sans" />

<TextView
    android:id="@+id/textView_meaning_list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/title_list"
    android:layout_below="@+id/title_list"
    android:layout_marginTop="10dp"
    android:text="TextView"
    android:textColor="#000000"
    android:textSize="25sp" />

  • 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-17T19:12:10+00:00Added an answer on June 17, 2026 at 7:12 pm

    I hope you have not provide android:dividerHeight attribute in your layout file under <ListView/>
    If so please remove it.

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

Sidebar

Related Questions

Trying to implement LoaderManager + CursorLoader. In onFinish method adapter should swap its cursor
Trying to implement 3-layer (not: tier, I just want to separate my project logically,
I am trying to implement a ListView with test values. It should display 2
I'm trying to create a listview with a static background image (i.e. not contained
I'm trying to implement a custom ArrayAdapter for a ListView. The ArrayList I want
I'm trying to implement a list using the ListView, which contains rows built with
I'm trying to implement a thread that shows a progressdialog before loading the listview
i am trying to implement ListView. Problem is that when i am showing items
I'm trying to implement a listView with EditText Controls. Problem is when I edit
i am trying to implement listbox (or listview): <ListView ItemsSource={Binding Players} SelectedIndex={Binding SelectedIndex}> My

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.