Amokrane Chentir
Amokrane Chentir

Reputation: 30385

Android -- How to remove that little extra padding when using a ListView with custom background?

I have the following layout:

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

  <ListView  
        android:id="@+id/xxx"
        android:layout_width="fill_parent"  
        android:layout_height="fill_parent"
        android:textColor="#464C59"         
        android:divider="#A4C539"
        android:dividerHeight="1px">
   </ListView>

    <ImageView
        android:id="@+id/home_bottom_bar"
        android:src="@drawable/bottombar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:clickable="true"/>
</FrameLayout>

The goal is to have some sort of advertising bar at the bottom of the activity (which contains a list of items). It works ok, except for one thing! There is some sort of extra space just under the bar (it's very small but it's noticeable enough). By the way, all the paddings are set to 0 so where does this space come from?

Thanks!

EDIT

After investigating the issue, it turns out that the custom background (#EAEAEA) is causing this extra space. Still don't know how to fix this though.

Upvotes: 2

Views: 3771

Answers (2)

lobner
lobner

Reputation: 593

When you mention that it is a small extra space, it may be the tiny gradient at the top and bottom. Created by ListView, when it is made scrollable.

You may read about ListView Backgrounds, this should give you the idea on how to fix it, if it is caused by this special gradient.

This gradient line can apparently also be removed: extra line in tab host

Upvotes: 1

user658042
user658042

Reputation:

You may want to use the merge tag since every activitys base layout is a FrameLayout. (This may cause the padding. Im not 100% sure on this one though) Look here.

Upvotes: 1

Related Questions