Typical search layout having RelativeLayout, TextView, EditText and Button
I have a.9.png image having height of 46px
The relative layout looks ok, but the views inside of it is too small, the Button don’t adapt the height size and EditText too.(using hdpi in tablet)
This is my code::
<RelativeLayout
android:id="@+id/cuadrobusqueda"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="9dp"
android:layout_marginLeft="14dp"
android:layout_marginRight="14dp"
android:layout_marginTop="8dp"
android:background="@drawable/bg_buscar_servicios"
android:gravity="center_vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="TextView" />
<EditText
android:id="@+id/editText1"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="27dp"
android:layout_toRightOf="@+id/textView1"
android:ems="10"
android:inputType="number" >
<requestFocus />
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="100dp"
android:layout_height="32dp"
android:layout_alignTop="@+id/textView1"
android:layout_marginLeft="26dp"
android:layout_toRightOf="@+id/editText1"
android:text="Button" android:textSize="11sp"/>
</RelativeLayout>
Any idea why it is happening?
Check the image you supplied in android:background=”@drawable/bg_buscar_servicios”, It’s height and also don’t give height of RealtiveLayout if you want to make it small and need more screen area just below it then try to give android:layout_weight which will automatically adjust according to your device.
But i’m sure problem with your Image check it out first..