开发者

How to fit text on Button?

开发者 https://www.devze.com 2023-03-24 01:38 出处:网络
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 w

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_paren开发者_开发问答t"
        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>


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

LinearLayout android:baselineAligned="false"


Use "wrap_content" for the layout_height property of the Button


Hi take a look at these http://developer.android.com/guide/practices/screens_support.html maybe if you have deferent styles for each screen it will solve your problem. :D

0

精彩评论

暂无评论...
验证码 换一张
取 消