Android button height does not change

I can not reduce the size of my button. Here is what I have in my xml:

<Button xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/button_small_left"
        style="?android:attr/buttonStyleSmall"
        android:layout_height="10px"
        android:height="10px"
        android:minHeight="10px"
        android:maxHeight="10px"
        android:padding="0px"
        android:textSize="6dip"
        android:text="asd"
/>

After that, the button is still displayed with a large upper and lower indent. The text appears in the middle. The button is used in relative layout.

+5
source share
2 answers

Strange - this works great when I created a new project to try again. The problem was supposed to be somewhere else.

0
source

Instead of px (pixel), use dp (density pixel) for the height and width of the buttons.

Example:

android:layout_height="10dp"

and for text size use only sp (scale index pixel)

android:textSize="6sp"

In the xml above, you forgot to specify the width attribute.

android:layout_width="40dp"
0
source

All Articles