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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:20:31+00:00 2026-05-23T14:20:31+00:00

Hello I have called a image behind the listview and listview is transparent. Each

  • 0

Hello I have called a image behind the listview and listview is transparent. Each record in the list is appearing on repeating image . how i can fix this repeat ion of image . Here is the xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="7dp"
    android:background="@drawable/ac"
    android:cacheColorHint="#00000000"


    >
<TextView  

    android:id="@+id/item_title"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:padding="2dp"
    android:textSize="20dp" />
    <TextView  
    android:id="@+id/item_subtitle"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="2dp"
    android:textSize="18dp" />
</LinearLayout>

Thanks

Now i have updated xml files like this
main xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/ac"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 

    />

    <ListView android:id="@+id/listView" 
    android:background="@drawable/ac"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" />


</LinearLayout>

List xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:cacheColorHint="#00000000"




    >
<TextView  

    android:id="@+id/item_title"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:padding="2dp"
    android:textSize="20dp" />
    <TextView  
    android:id="@+id/item_subtitle"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="2dp"
    android:textSize="18dp" />
</LinearLayout>

and in the activity calling in this way

{ R.id.item_title, R.id.item_subtitle }

the whole code looks like

public class Test extends ListActivity  {
      Prefs myprefs = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listplaceholder);
        this.myprefs = new Prefs(getApplicationContext());
        // install handler for processing gui update messages
        ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
       JSONObject json = JSONfunctions.getJSONfromURL("...............");

        try{

            JSONArray  earthquakes = json.getJSONArray("services");

            for(int i=0;i<earthquakes.length();i++){                        
                HashMap<String, String> map = new HashMap<String, String>();    
                JSONObject e = earthquakes.getJSONObject(i);

                map.put("id", e.getString("taskid"));
                map.put("pic", "Service name : " + e.getString("employeepic"));
                map.put("serviceinfo", "" +  e.getString("employeename")+ " : "+ e.getString("starttime")
                        +" To " +  e.getString("endtime"));
                mylist.add(map);            
            }       
        }catch(JSONException e)        {
             Log.e("log_tag", "Error parsing data "+e.toString());
        }

        ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.test, 
                        new String[] { "servicename", "serviceinfo" }, 
                        new int[] { R.id.item_title, R.id.item_subtitle });

        setListAdapter(adapter);

        final ListView lv = getListView();
        lv.setTextFilterEnabled(true);  
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
                @SuppressWarnings("unchecked")
                HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);                   
                Toast.makeText(Test.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_SHORT).show(); 

            }
        });

    }
  • 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-23T14:20:31+00:00Added an answer on May 23, 2026 at 2:20 pm

    I suppose you are using the above XML to populate the items in the list view (i.e) inside getView() …

    1. Remove android:background="@drawable/ac" from the above XML.
    2. Add it to the ListView’s XML say,

    <ListView android:id="@+id/listView" 
        android:background="@drawable/ac"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" />
    

    Explanation:

    Setting Background to the layout that you are using to populate the list will produce ‘repeating image’ because you are setting background to the child (i.e) the listView’s item and not to the List.

    EDIT:
    1.For your Activity, you will be loading the ListView from an Layout File(say main.xml), inside that layout file for the ListView add the background.

    2. Remove the background from the LinearLayout in your above code.

    Edit Again:

    use the following XML,

    main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/ac"
        >
    <TextView  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"/>
    
        <ListView android:id="@+id/listView" 
        android:background="#00000000"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" />
    
    </LinearLayout>
    

    List xml file

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:cacheColorHint="#00000000"
        android:background="#00000000"
        >
    <TextView  
    
        android:id="@+id/item_title"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:padding="2dp"
        android:textSize="20dp" />
        <TextView  
        android:id="@+id/item_subtitle"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:padding="2dp"
        android:textSize="18dp" />
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Activity called main. If I call Toast.makeText(this, Hello World from main,
In this simplified scenario, I have a model called Post Each post has a
Hello I have a jquery function called create time box This creates a textbox
Let's say I have an image called hello.png with dimensions 200x100 . I create
I have a file called hellowf.cs class MyFirstApp { static void Main() { System.Windows.Forms.MessageBox.Show(Hello,
I have the following data: A post called Hello has categories greet Another post
Hello I have been having trouble with this for a while now. I have
If i have a ListView (called MainList) and want to bind to elements in
Hello I have this rewrite Rule at my Wordpress RewriteRule ^trip/(.*)/$ /index.php?page_id=143&trip=$1 [L] Its
I have a test page that displays two images. One called hello.bmp and another

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.