Solved

Border around ListView in Android app

Posted on 2013-06-20
3
2,561 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Certificat to iSeries KeyStore 1 31
MyDlink DCS930L camera Registration/Account 4 126
phone area codes 3 44
Beacon technology 3 30
Once again I push the limits of my phone.  An introduction to the Android Google Now Launcher.
A short article about a problem I had getting the GPS LocationListener working.
This video teaches viewers about errors in exception handling.
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.
Suggested Courses

751 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