Reputation: 11350
I have the below layout which contains a button, I'm trying to reduce the size, mainly height, of button, but button height allows stays the same
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/buttonlayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="right"
android:orientation="horizontal"
android:background="#FFDBE2ED"
android:paddingBottom="0dp"
android:paddingTop="0dp" >
<!--Button
android:id="@+id/btnSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginTop="2px"
android:height="15dp"
android:text="Save"
android:textSize="15sp"
android:width="70dp" >
</Button -->
<Button
android:id="@+id/btnClear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0px"
android:layout_marginLeft="10px"
android:layout_marginRight="3px"
android:layout_marginTop="2px"
android:height="0dp"
android:text="Clear"
android:textSize="15sp"
android:width="70dp"
>
</Button>
</LinearLayout>
any idea?
Upvotes: 0
Views: 96
Reputation: 4214
Just tried your code and button looks fine. What do you want to look it like? Button as small(short) as it defined by current android theme. You have to change button style to custom one, to make spacing inside of the button different to make it shorter.
When you place standard android button android will use its theme style, including 9-patch image for button background. That image has internal paddings for the text. If you need a different look of the button then you need to create a custom Button control inherited from the Button and overwrite styles.
Upvotes: 1
Reputation: 5223
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Instead of using wrap_content
you can specify a view's width or height using DP (Density Independant Pixels) Try changing wrap_content
to 50dp
or whatever value that suits your needs.
Upvotes: 1
Reputation: 35598
You're using android:layout_height="wrap_content"
which means it will always be as tall as the content inside it. Try playing around with that value to change the height.
Upvotes: 2