S Sanxion Active Member Licensed User Longtime User Dec 13, 2015 #1 Guys Does anybody know of a method to 'highlight' a label for the moment that it is clicked on only? Thank-you in advance!
Guys Does anybody know of a method to 'highlight' a label for the moment that it is clicked on only? Thank-you in advance!
klaus Expert Licensed User Longtime User Dec 13, 2015 #2 Not directly, you could use buttons for this. Upvote 0
S Sanxion Active Member Licensed User Longtime User Dec 13, 2015 #3 Can buttons have a transparent background in the same way that a label can? Upvote 0
I inakigarm Well-Known Member Licensed User Longtime User Dec 13, 2015 #4 Not sure if this is what you're searching (when click on label, the border is drawed) Code: Copy Sub Label1_Click Dim cd As ColorDrawable cd.Initialize2(Colors.Transparent,2,2,Colors.Black) Label1.Background=cd End Sub The drawback is to return to a non-click state (you'd have to code when clicking the other views of the activity) Upvote 0
Not sure if this is what you're searching (when click on label, the border is drawed) Code: Copy Sub Label1_Click Dim cd As ColorDrawable cd.Initialize2(Colors.Transparent,2,2,Colors.Black) Label1.Background=cd End Sub The drawback is to return to a non-click state (you'd have to code when clicking the other views of the activity)
canalrun Well-Known Member Licensed User Longtime User Dec 14, 2015 #5 For the label I am pretty sure you can achieve highlighting when pressed by using an on-touch listener. There are examples for setting on-touch for a view in the forum. I have never done this, but I think it should be possible. On down change the text color to the highlight color. On up change the text back. Also, I've never done this, but if you define statelist bitmaps for a button, I will bet if you make a portion of the bitmap transparent you could achieve transparency. Again I have never done this, but it could be an interesting effect. I'm sure I will be corrected, if wrong. Barry. Upvote 0
For the label I am pretty sure you can achieve highlighting when pressed by using an on-touch listener. There are examples for setting on-touch for a view in the forum. I have never done this, but I think it should be possible. On down change the text color to the highlight color. On up change the text back. Also, I've never done this, but if you define statelist bitmaps for a button, I will bet if you make a portion of the bitmap transparent you could achieve transparency. Again I have never done this, but it could be an interesting effect. I'm sure I will be corrected, if wrong. Barry.
klaus Expert Licensed User Longtime User Dec 14, 2015 #6 Sanxion said: Can buttons have a transparent background in the same way that a label can? Click to expand... Sure, no problem! For the Background you must set StateListDrawable and for the Enabled state set a ColorDrawable with a transparent color and for the Pressed state set a ColorDrawable with a border and a transparent color. This can be done in the Designer or in the code. Upvote 0
Sanxion said: Can buttons have a transparent background in the same way that a label can? Click to expand... Sure, no problem! For the Background you must set StateListDrawable and for the Enabled state set a ColorDrawable with a transparent color and for the Pressed state set a ColorDrawable with a border and a transparent color. This can be done in the Designer or in the code.
S Sanxion Active Member Licensed User Longtime User Dec 14, 2015 #7 Thank-you for all the responses...I will give them a try! Upvote 0