Solved

Border around ListView in Android app

Posted on 2013-06-20
3
2,611 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

632 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