java - RelativeLayout doesn't meet it's on height -


i trying create relative layout toolbar keep on having such height problem shown below:

enter image description here

what want is:

enter image description here

here's code:

<?xml version="1.0" encoding="utf-8"?>  <relativelayout      xmlns:android="http://schemas.android.com/apk/res/android"      android:orientation="vertical"      android:layout_width="match_parent"      android:layout_height="match_parent">      <android.support.v7.widget.toolbar          android:id="@+id/searchtoolbar"          android:layout_height="?attr/actionbarsize"          android:layout_width="match_parent"          android:background="@color/toolbar_default_color"          android:minheight="?attr/actionbarsize">      </android.support.v7.widget.toolbar>      <relativelayout          android:layout_below="@+id/searchtoolbar"          android:layout_width="match_parent"          android:layout_height="wrap_content">          <relativelayout              android:id="@+id/filterlayout"              android:layout_width="match_parent"              android:layout_height="40dp">              <imagebutton                  android:layout_width="wrap_content"                  android:layout_height="wrap_content"                  android:src="@drawable/search_filter_icon"                  android:background="@drawable/search_filter_bgn_btn"                  android:layout_marginright="10dp"                  android:layout_marginbottom="10dp"                  android:layout_alignparentright="true"                  android:layout_alignparentbottom="true"/>          </relativelayout>      <listview          android:id="@+id/feed_listview"          android:layout_below="@+id/filterlayout"          android:layout_margintop="?attr/actionbarsize"          android:layout_width="fill_parent"          android:layout_height="wrap_content"          android:divider="@null" />      </relativelayout>  </relativelayout>

in imagebutton use: android:layout_height="match_parent"

instead of android:layout_height="wrap_content"

or resize image using photoshop or other free tool fit 40dp exactly.

wrap_content: means view wants big enough enclose content (plus padding)

what need:

match_parent: means view wants big parent (minus padding)

documentation.


Comments