lol...I just found out why. It is a stupid mistake.

My background image is 400X100, but I ignored the white space which counts
up to 200 pixel wide. That is why I can't see the whole image filling out
the screen horizontally.

Sorry for my stupid mistake.

Please ignore my question.

Thanks.

Stanley

On Wed, Jun 9, 2010 at 5:05 PM, Stanley Li <[email protected]> wrote:

> Sorry, I have tried all attributes for android:scaleType but it still
> doesn't work.
>
> I tried debugging it using log.d to see the width of the view
>
> int a =startGameB.getWidth();
> int b = startGameB.getHeight();
> log.d(TAG, String.valueOf(a));
> log.d(TAG, String.valueOf(b));
>
> the result is "width = 480px", which is what I want. However, the
> background image is not 480px. It is much smaller than 480px.
>
> Again, the xml for the button is:
>
> <Button
> android:id="@+id/start_game_button"
> android:layout_width="480px"
> android:layout_height="wrap_content"
> android:text="@string/Start_Game"
> android:textSize="25dip"
> android:layout_gravity="center_horizontal"
> android:background="@drawable/startgame_button"
> />
>
> How can I change the size of the background image for the button?
>
>
>
> Thanks so much,
>
> Stanley
>
> On Wed, Jun 9, 2010 at 3:10 PM, HeHe <[email protected]> wrote:
>
>> i guess you could try android:scaleType attribute.
>>
>> On Jun 9, 2:06 pm, Stanley Li <[email protected]> wrote:
>> > Hi all,
>> >
>> > I try to make a button with a background image. However, the background
>> > image is scaled down.
>> >
>> > In my xml code, I have:
>> >
>> > <Button
>> > android:id="@+id/start_game_button"
>> > android:layout_width="480px"
>> > android:layout_height="wrap_content"
>> > android:text="@string/Start_Game"
>> > android:textSize="25dip"
>> > android:layout_gravity="center_horizontal"
>> > android:background="@drawable/startgame_button"
>> > />
>> >
>> > The background image is 400X100. However, when it goes to the screen
>> > (480X854), the image is much smaller than 400 pixel wide.
>> >
>> > If i use an image of 480X100, the image still can't fit the whole
>> screen.
>> >
>> > It seems there is a relationship between layout_width and the size of
>> the
>> > background image. For example, when i set layout_width=700px, the
>> background
>> > image's width is increased but it still can't fit the whole screen
>> > horizontally.
>> >
>> > Can any help me with this?
>> >
>> > Thanks so much.
>> >
>> > Stanley
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<android-developers%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to