ArminKH Well-Known Member Mar 24, 2016 #1 hi as u know image view has a property named gravity which has two special gravity named Gravity.Fill and Center now i have a panel and i want to use an image as a background for this panel which is a drawable or bitmap but images in panel's background have the Fill gravity as default and will be stretched but i want to use some thing like Gravity.Center property for a panel similar to image view i know panel has not gravity and maybe we need to set drawable or bitmaps gravity and i know it's possible by add another panel or image view into base panel but what i'm looking for it is a direct way to achieve to this thanks in advance Last edited: Mar 24, 2016
hi as u know image view has a property named gravity which has two special gravity named Gravity.Fill and Center now i have a panel and i want to use an image as a background for this panel which is a drawable or bitmap but images in panel's background have the Fill gravity as default and will be stretched but i want to use some thing like Gravity.Center property for a panel similar to image view i know panel has not gravity and maybe we need to set drawable or bitmaps gravity and i know it's possible by add another panel or image view into base panel but what i'm looking for it is a direct way to achieve to this thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Mar 24, 2016 #2 You can use BitmapDrawable and change its gravity property. Upvote 0
ArminKH Well-Known Member Mar 24, 2016 #3 Erel said: You can use BitmapDrawable and change its gravity property. Click to expand... this is designer property it's not exist out of designer what is the workaround for modules? Upvote 0
Erel said: You can use BitmapDrawable and change its gravity property. Click to expand... this is designer property it's not exist out of designer what is the workaround for modules?
ArminKH Well-Known Member Mar 24, 2016 #4 thank u @Erel Code: Private Sub setBitmapDrawableGravity(Drawable As BitmapDrawable, DrawableGravity As Int) Dim jo As JavaObject = Drawable jo.RunMethod("setGravity",Array(DrawableGravity)) End Sub Upvote 0
thank u @Erel Code: Private Sub setBitmapDrawableGravity(Drawable As BitmapDrawable, DrawableGravity As Int) Dim jo As JavaObject = Drawable jo.RunMethod("setGravity",Array(DrawableGravity)) End Sub
Erel B4X founder Staff member Licensed User Longtime User Mar 25, 2016 #5 ArminKH said: it's not exist out of designer Click to expand... That's not correct. Code: Dim d As BitmapDrawable d.Gravity = Gravity.FILL Upvote 0
ArminKH said: it's not exist out of designer Click to expand... That's not correct. Code: Dim d As BitmapDrawable d.Gravity = Gravity.FILL
ArminKH Well-Known Member Mar 25, 2016 #6 Erel said: That's not correct. Code: Dim d As BitmapDrawable d.Gravity = Gravity.FILL Click to expand... Oh oh sorry it's a mistake between Bitmap and BitmapDrawable declearition Upvote 0
Erel said: That's not correct. Code: Dim d As BitmapDrawable d.Gravity = Gravity.FILL Click to expand... Oh oh sorry it's a mistake between Bitmap and BitmapDrawable declearition