Android Question Label Background Image Aspect Ration

Jmu5667

Well-Known Member
Licensed User
Longtime User
hi

I have a navigation bar in my app. It has 3 labels which size themselves based on the screen width. Each label has an image assigned to their background(done in the designer) the images are smaller then the label widths.

If the user clicks one of the labels I want to change the background image, but when I do the result is a distorted backgound. How can I maintain the aspect ratio as it it when the app load ?

B4X:
Sub lblSettings_Click

   lblSettings.Gravity = Gravity.CENTER
   lblSettings.SetBackgroundImage(LoadBitmap(File.DirAssets, "settings_on.png"))



End Sub

the settings in the designer are;

upload_2014-4-2_12-57-53.png


Thanks.

John.
 

Jmu5667

Well-Known Member
Licensed User
Longtime User
Yes that is a possible solution, but I really would like to know why the aspect ratio is not maintained in the label, or if there is a code workaround.
 
Upvote 0
Top