B Bryan Member Licensed User Longtime User Jul 12, 2013 #1 I have a Samsung Note 8 tablet running android 4.1.2. I'm using B4A 2.52 currently. I have created a panel with 2 buttons in designer. For the buttons I have used .png images the same size as the buttons. They were created in photoshop. The panel with the two buttons are used for a widget. In the B4A designer app on the device the images display correctly. After compiling the code the buttons are just gray boxes but still function normally. I cannot figure out what to do to make the images display. Could this be related to the android 4.1.2 OS? Would updating to B4A 2.72 fix this problem? Should I just assign the images to the buttons in code instead? Help is always greatly appreciated. Thanks, Bryan
I have a Samsung Note 8 tablet running android 4.1.2. I'm using B4A 2.52 currently. I have created a panel with 2 buttons in designer. For the buttons I have used .png images the same size as the buttons. They were created in photoshop. The panel with the two buttons are used for a widget. In the B4A designer app on the device the images display correctly. After compiling the code the buttons are just gray boxes but still function normally. I cannot figure out what to do to make the images display. Could this be related to the android 4.1.2 OS? Would updating to B4A 2.72 fix this problem? Should I just assign the images to the buttons in code instead? Help is always greatly appreciated. Thanks, Bryan
Erel B4X founder Staff member Licensed User Longtime User Jul 14, 2013 #2 It is most probably not related to the OS version. Can you upload your layout file with the images? Upvote 0
B Bryan Member Licensed User Longtime User Jul 20, 2013 #3 Erel said: It is most probably not related to the OS version. Can you upload your layout file with the images? Click to expand... I see now that I cannot use statelistdrawable for buttons in designer for widgets. Instead I used imageview for the buttons. This works out nicely to create buttons except I would like to be able to display a pressed state for these buttons. I decided to load new images that would display a pressed state for the buttons on imageview_click event. This works but is way to fast to even see the change of images. Is there a simple way to slow it down so the "pressed state" image is displayed a little longer before I change it back to the "un-pressed state" image. Here is what I am doing. I can barely see the change of the images because they switch too fast. I would need a delay possibly for a few milliseconds. Shoul Code: Copy Sub ImageView1_click rv.SetImage("Imageview1",LoadBitmap(File.DirAssets,"BlankB.png")) rv.UpdateWidget rv.SetImage("Imageview1",LoadBitmap(File.DirAssets,"IN1.png")) rv.UpdateWidget Upvote 0
Erel said: It is most probably not related to the OS version. Can you upload your layout file with the images? Click to expand... I see now that I cannot use statelistdrawable for buttons in designer for widgets. Instead I used imageview for the buttons. This works out nicely to create buttons except I would like to be able to display a pressed state for these buttons. I decided to load new images that would display a pressed state for the buttons on imageview_click event. This works but is way to fast to even see the change of images. Is there a simple way to slow it down so the "pressed state" image is displayed a little longer before I change it back to the "un-pressed state" image. Here is what I am doing. I can barely see the change of the images because they switch too fast. I would need a delay possibly for a few milliseconds. Shoul Code: Copy Sub ImageView1_click rv.SetImage("Imageview1",LoadBitmap(File.DirAssets,"BlankB.png")) rv.UpdateWidget rv.SetImage("Imageview1",LoadBitmap(File.DirAssets,"IN1.png")) rv.UpdateWidget
MotoMusher Active Member Licensed User Longtime User Jul 20, 2013 #4 set a timer to 1000 for 1 second (ms). Move the last 2 lines above to a timer_tick event. be sure to disable the timer in that even as well. Upvote 0
set a timer to 1000 for 1 second (ms). Move the last 2 lines above to a timer_tick event. be sure to disable the timer in that even as well.
B Bryan Member Licensed User Longtime User Jul 23, 2013 #5 Thanks, much I will give that a try. I was playing around with using beeper from the audio lib. I was setting it to a time to about 500 ms and a very low frequency that couldn't be easily heard and that worked good as a timer. But I'll try the timer method so I don't need to have to load an additional lib (audio) just for a delay. Upvote 0
Thanks, much I will give that a try. I was playing around with using beeper from the audio lib. I was setting it to a time to about 500 ms and a very low frequency that couldn't be easily heard and that worked good as a timer. But I'll try the timer method so I don't need to have to load an additional lib (audio) just for a delay.
C chrjak Active Member Licensed User Longtime User Feb 28, 2014 #6 hey guys, I have the same problem but its harder than his... I would do it with an Imageview but i can't export my Buttons as Images... Always there are some corners... Is there a trick to export the Button Design as Image? Erel should know... Regards Upvote 0
hey guys, I have the same problem but its harder than his... I would do it with an Imageview but i can't export my Buttons as Images... Always there are some corners... Is there a trick to export the Button Design as Image? Erel should know... Regards
Erel B4X founder Staff member Licensed User Longtime User Feb 28, 2014 #7 The corners are part of the button background image. You can use Canvas.DrawDrawable to draw a button an a bitmap. Upvote 0
The corners are part of the button background image. You can use Canvas.DrawDrawable to draw a button an a bitmap.
C colin van Blommestein Member Licensed User Longtime User Feb 28, 2014 #8 Erel said: The corners are part of the button background image. You can use Canvas.DrawDrawable to draw a button an a bitmap. Click to expand... Hi Erel I'm trying to resolve a DBUtils NullPointerException error SQL.ExecNonQuery2(sb.ToString, args) The sb string and args are correctly formatted The sequence of events is Extract a record Populate edit objects Change contents of edit object UPDATE the record Am I missing something in the sequence of events? Upvote 0
Erel said: The corners are part of the button background image. You can use Canvas.DrawDrawable to draw a button an a bitmap. Click to expand... Hi Erel I'm trying to resolve a DBUtils NullPointerException error SQL.ExecNonQuery2(sb.ToString, args) The sb string and args are correctly formatted The sequence of events is Extract a record Populate edit objects Change contents of edit object UPDATE the record Am I missing something in the sequence of events?
C chrjak Active Member Licensed User Longtime User Feb 28, 2014 #9 Erel said: The corners are part of the button background image. You can use Canvas.DrawDrawable to draw a button an a bitmap. Click to expand... How can i set the Button text? Last edited: Feb 28, 2014 Upvote 0
Erel said: The corners are part of the button background image. You can use Canvas.DrawDrawable to draw a button an a bitmap. Click to expand... How can i set the Button text?
S strat Active Member Licensed User Longtime User Feb 28, 2014 #10 chrjak said: How can i set the Button text? Click to expand... Try this. It may be exactly what you want to do. http://www.b4x.com/android/forum/threads/button-draw-draw-text-and-image-on-a-button.36781/ Upvote 0
chrjak said: How can i set the Button text? Click to expand... Try this. It may be exactly what you want to do. http://www.b4x.com/android/forum/threads/button-draw-draw-text-and-image-on-a-button.36781/
C chrjak Active Member Licensed User Longtime User Feb 28, 2014 #11 strat said: Try this. It may be exactly what you want to do. http://www.b4x.com/android/forum/threads/button-draw-draw-text-and-image-on-a-button.36781/ Click to expand... Puhh- very confusing Upvote 0
strat said: Try this. It may be exactly what you want to do. http://www.b4x.com/android/forum/threads/button-draw-draw-text-and-image-on-a-button.36781/ Click to expand... Puhh- very confusing
S strat Active Member Licensed User Longtime User Feb 28, 2014 #12 The code may be confusing but you can use it by call buttondraw sub. Upvote 0