Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fit text on Button?

In my android app I have a Button for voting photos. When the user select this Button, the text on this Button became "Thanks for your vote" and when he see a photo that he voted before, on Button will see the text "you have already vote for this photo"...the problem is that it looks like this : http://i55.tinypic.com/t4z3vl.png

Can anyone help me hot can I fit the text on Button?

Any idea is welcome. Thanks in advance.

In xml I have this :

<LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_below="@id/imagetitle"
        android:orientation="horizontal">
        <Button android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Previous" android:id="@+id/previous" />
        <Button android:layout_width="185dip" android:layout_height="wrap_content"
            android:text="Vote for this picture" android:id="@+id/vote" />
        <Button android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:text="Next" android:id="@+id/next" />
    </LinearLayout>
like image 706
Gabrielle Avatar asked Aug 01 '11 11:08

Gabrielle


People also ask

How do I adjust text on a button in HTML?

To change the font size of a button, use the font-size property.

How do you make a button expand with text?

Set a padding to the container, it will make it larger depending on how much text is added. For example: padding: 4px 10px; So in your case, remove the width from your <a> selector and add the padding.

How do you create a button in full width of a container?

display: block and width: 100% is the correct way to go full width but you need to remove the left/right margin on the button as it pushes it outside the containing element. for more information on the box-sizing property, read the MDN docs.


1 Answers

i think you want to align the top of all buttons add this line in your layout

LinearLayout android:baselineAligned="false"
like image 170
Avi Dhiman Avatar answered Sep 29 '22 16:09

Avi Dhiman