Clickable Hidden Button or Image
Asked Answered
C

3

1

In android is there anything thing like we can create a hidden button or image and it is still clickable.or alternately is there any way to achieve this functionality in Android. In ios we have the benefit of placing a clickable hidden button.

Clardy answered 27/7, 2012 at 13:0 Comment(0)
W
4

Everything can be achieved in Android

<Button...
  android:background="@null">
Wieland answered 27/7, 2012 at 13:1 Comment(0)
C
1

You can make the button transparent or translucent by using the background property:

android:background="#ARGB"

where A is the transparency, which can be set between 0-F i.e., 0 means transparent and F means opaque. The remaining colours are R-Red, G-Green, B-Blue. so an eg. might be:

android:background="#200B"

which gives a tinge of blue colour.

This way you can provide transparency as well as a tinge of transparent colour to your view. This works with any view.

Also you can apply this through code:

button.setBackgroundColour(0x220000BB); 
Cicala answered 27/7, 2012 at 14:30 Comment(5)
alternatively you can use the alpha property of the button (or any other view) and set it between 0 to 1; where 0 means completely transparent and 1 means completely opaque. Setting it to 0 will make your button completely transparent. you will still be able to click that button and do whatever you want to. Is that what u want?Cicala
yeah vickey exactly this kind of feature i want.can u please tell me how we can use the alpha property of a view.Clardy
if u want to make your button transparent i.e. your button will still be there but you can see right through it, set Alpha to 0. Just add this line into your button declaration in the xml file: android:alpha="0".Cicala
Hi vickey, i tried the way u said but i was not able to run it,it is showing me some error can u please elaborate more.I jus provided the error also. error: No resource identifier found for attribute 'alpha' in package 'android'Clardy
okay the alpha property works only for android 3.0 and above. You may try this link it will help u: https://mcmap.net/q/1482925/-android-hiding-viewsCicala
C
0

Probably use a transparent Image to the button.

Caston answered 27/7, 2012 at 13:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.