How to make a scalable button with picture on it ?

basicall

Member
Licensed User
Longtime User
I want to make a button something likes button on android phone's dialer keypad. For example, on dialer keypad, the DTMF key button 2 has picture shown with content "2 ABC". The button should be scalable. That is to say, I could not use a normal picture as background no matter with b4a code or set enabled drawable to bitmapdrawable In designer. Maybe you want to tell me I should use nine pitch picture but I think nine pitch picture might only good for background without content shown on it.

After I processed phone's default phone.apk with apktool I understand their keypad button is composed of nine pitch png picture and a normal png picture. But I do not know how to do it with b4a.

Button is really the most basic requirement. I have struggled it for 3 days. Help me please. :sign0085:
 

susu

Well-Known Member
Licensed User
Longtime User
You can use ImageView with Gravity = Gravity.Fill with size = Xdip.
But I think the best way is 9 Pitch button.
 
Upvote 0

basicall

Member
Licensed User
Longtime User
You can use ImageView with Gravity = Gravity.Fill with size = Xdip.
But I think the best way is 9 Pitch button.

Sir,

Thanks for your prompt reply. But I am have a question about 9 Pitch button. If there has picture on 9 pitch png file, could the picture still be shown well on different size of buttons ? I am afraid it will be streched and not [good looking] any more.
 
Upvote 0

basicall

Member
Licensed User
Longtime User
Hi Erel. I have a silly question. Why after I assign a image to a button the button does not has borders visible any more ?
 
Upvote 0
Top