Solved

Border around ListView in Android app

Posted on 2013-06-20
3
2,494 Views
Last Modified: 2013-06-24
Hello Android Experts,

I have a ListView and for some reason I cannot get rid of a thick white border around it.  I've attached a screenshot too.  I would appreciate any guidance as to how I can get rid of the border.  Below is the XML of my ListItem.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#000000"
    android:clickable="true"
    android:orientation="horizontal"
    android:paddingLeft="10dp"
    android:paddingTop="10dp" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:contentDescription="@string/hello_world"
        android:src="@drawable/logo1" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="14dp"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="10dp"
        android:text="@string/hello_world"
        android:textColor="@color/NormalText"
        android:textSize="18sp" />

</LinearLayout>

Open in new window

ListView-border.png
0
Comment
Question by:Modifier1000
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
PCableGuy earned 500 total points
ID: 39268826
Try playing with the background color of your ListView in its XML to better match your ListItem

as in this example, the ListView has a black background, fills the parent, etc.

 <ListView
        android:id="@+id/listView2"
        android:background="#000000"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:dividerHeight="2sp" >
    </ListView>
0
 

Author Closing Comment

by:Modifier1000
ID: 39270316
I changed per your code, but got same result with the exception that the divider lines are no longer visible due to the background color being black now.

But I did change the background of the layout itself.  And got what I needed.  I guess your suggestion of "playing with the background color" got me to think about what was different from my other layouts.  It was the background image was missing.  My dumb mistake.

Thanks for the 2nd pair of eyes!
0
 
LVL 12

Expert Comment

by:PCableGuy
ID: 39273513
Good, sometimes a little nudge helps.....thanks for the points.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Often, people trade privacy and security for convenience. However in today's concrete jungle, this is an extremely foolish decision considering the vast amount of technologies being used against consumer interest. First off, I won't waste any time e…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question