Change button colors

mrossen

Active Member
Licensed User
Longtime User
Hi,

Is it possible to change the released and the pressed color for at button.

I haved changes the button to have 0dip corners but now can I not see if the button is pressed.

I have used this code to remove the corners.

B4X:
Dim cdwColor As ColorDrawable
   cdwColor.Initialize(Colors.Transparent , 0dip)
   ButtonAnswer.TextColor  = Colors.White 
   ButtonNext.textColor = Colors.White
   ButtonAnswer.Background = cdwColor
   ButtonNext.Background = cdwColor

Mogens
 

mrossen

Active Member
Licensed User
Longtime User
Hi Erel,

Yes you are right, but I need to have the buttons fixed in the bottom of the screen and the rest of the screen in a Scrollview.

So I have done this

B4X:
ScrollViewMain.Initialize(0)
   ScrollViewScore.Initialize(0)
   PanelMain.Initialize(0)
   PanelHighScore.Initialize(0)
   
   PanelMain = ScrollViewMain.Panel 
   Activity.AddView(ScrollViewMain, 0, 0, 100%x, 100%y - 50dip)
   
   If Activity.Height > 480dip Then
      PanelMain.Height = 100%y - 50dip
   Else
      PanelMain.Height = 430dip
   End If
   
   PanelMain.Width = 100%x
   PanelMain.LoadLayout("cast")
   ScrollViewMain.Visible = True
   
   ButtonAnswer.Initialize("ButtonAnswer")
   Activity.AddView(ButtonAnswer, 0%x, 100%y - 50dip, 50%x, 50dip)
   ButtonNext.Initialize("ButtonNext")
   Activity.AddView(ButtonNext, 50%x, 100%y - 50dip, 50%x, 50dip)

Can I do this in the designer?

BTW, I love the new Script Designer

Mogens
 
Upvote 0

jeronimovilar2

Member
Licensed User
Longtime User
color

but "red", "blue"...is a variable (string) from database

button1.color = color. & variable

or

dim clr as int
clr = color. & variable
button1.color = clr

how can i do?
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
Very good Klaus.

So simple of course. Maps are very useful I am finding.

Regards, Ricky
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…