U unba1300 Guest Feb 13, 2012 #1 Hi. I have a scrollview that I add many edittexts to within a loop and I'm adding a background for each like so... Code: et.SetBackgroundImage(LoadBitmap(File.DirAssets,"etbackground.jpg")) Is this the 'normal' way to do it? Seems odd to be loading the bitmap each time. I thought of doing it before the loop, but the edittext is initialized each time at the start of the loop in order to clear what was there before. I also don't understand the difference between .Background and .SetBackgroundImage. Thanks.
Hi. I have a scrollview that I add many edittexts to within a loop and I'm adding a background for each like so... Code: et.SetBackgroundImage(LoadBitmap(File.DirAssets,"etbackground.jpg")) Is this the 'normal' way to do it? Seems odd to be loading the bitmap each time. I thought of doing it before the loop, but the edittext is initialized each time at the start of the loop in order to clear what was there before. I also don't understand the difference between .Background and .SetBackgroundImage. Thanks.
derez Expert Licensed User Longtime User Feb 13, 2012 #2 You can set a bitmap once with the picture and then use it in the loop: Code: Dim bmp As Bitmap bmp.Initialize(File.DirAssets,"etbackground.jpg") ... et.SetBackgroundImage(bmp) .background sets the background drawable if this is what you want to use, .setbackgroundimage use an image to set the background. Upvote 0
You can set a bitmap once with the picture and then use it in the loop: Code: Dim bmp As Bitmap bmp.Initialize(File.DirAssets,"etbackground.jpg") ... et.SetBackgroundImage(bmp) .background sets the background drawable if this is what you want to use, .setbackgroundimage use an image to set the background.