Reputation: 11678
This is my ListView XML code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+list/list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/defaultbg"
android:drawSelectorOnTop="false" />
<ImageButton
android:id="@+list/filter_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:contentDescription="@string/SmallLogo"
android:scaleType="fitXY"
android:src="@drawable/filter" />
<!-- empty view -->
<TextView
android:id="@+list/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/defaultbg"
android:gravity="center"
android:text="@string/whos_around_empty_text"
android:textAppearance="@android:style/TextAppearance.Medium"
android:textColor="@android:color/white"
android:textStyle="bold" />
<EditText
android:id="@+list/filter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:hint="@string/search"
android:visibility="visible"/>
</RelativeLayout>
The EditText is at the bottom of the view but from some reason it is not tight to the bottom..
When examine it carefully I've seen that the layout is right on bottom - but the inside white background doesn't cover the whole layout (kind of like when the ImageView size is bigger then the layout size and you use scaleType)..
It is really important to me that the EditText will be tight to the bottom... any ideas ??
UPDATE: Adding screen shot:
As you can see - the bottom of the editText white background is not aligned down to the bottom of the screen... although the layout itself is aligned
Upvotes: 8
Views: 7501
Reputation: 8742
In Android, all widgets have some padding and margin from other views for better visibility. Every widget have 4 dp margin and 8 dp padding. If you don't want that you can create a custom view.
For now, Try margin at the bottom with negative pixels.
android:layout_marginBottom="-4dp"
worked fine on my layout
Upvotes: 5
Reputation: 3261
Try this, I have done like that screen.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/whos_around_empty_text"
android:background="@drawable/defaultbg"
android:textAppearance="@android:style/TextAppearance.Medium"
android:textColor="@android:color/white"
android:textStyle="bold" />
<RelativeLayout
android:id="@id/relative"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<ImageButton
android:id="@+list/filter_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:contentDescription="Smalllogo"
android:scaleType="fitXY"
android:src="@drawable/filter" />
<!-- empty view -->
<EditText
android:id="@+list/filter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:hint="Search"
android:visibility="visible" />
</RelativeLayout>
<ListView
android:id="@+id/list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/defaultbg"
android:layout_above="@id/relative"
android:layout_below="@id/empty"
android:drawSelectorOnTop="false" />
Upvotes: 0