I have a button that says "Sign In". When the user hits it it brings up an alert dialogue that takes user log in info. Once the user inputs their info and hits OK the button stretches to the width required to contain "Welcome, [User Name]". What I'm trying to do is to animate the change in width of the button from "Sign In" to "Welcome, [User Name]".
I've made the button background with a nine patch, which works perfectly if I specify different widths in the xml file. When I try to animate a change in width from the default width to a longer width it just stretches like a normal .png and not a 9.png.
Here's the code I'm using to stretch from one static width to another:
<Button
android:id="@+id/signIn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/button_nine_patch"
android:textSize="20dip"
android:layout_marginBottom="-2dip" />
And
ScaleAnimation stretch = new ScaleAnimation(1.0f ,10.0f, 1.0f, 1.0f);
this.signIn = (Button) this.findViewById(R.id.signIn);
this.signIn.setOnClickListener(this);
stretch.setDuration(2000);
signIn.startAnimation(stretch);
Since I don't know how many letters a person's name will be I need to be able to set the final width of the button from code.
I've googled like crazy and gone over all the android documentation but I just can't find an answer to this problem.
Any help would be MUCH appreciated.