togglebutton

mute and unmute button toggle html5 audio

▼魔方 西西 提交于 2019-11-27 07:17:09
问题 I've understood how to mute an <audio> sound object by putting this code : <a href="#" onclick="document.getElementById('ambiance').muted = true; return false"> mute sound </a> Now I'm searching how to mute/unmute my sound using the same button with the option to toggle it ? Can anyone give me directions? 回答1: var audioElm = document.getElementById('ambiance'); audioElm.muted = !audioElm.muted; 回答2: Try this: .unmute { background-image: url(http://franriavilla.in/images/unmute.png);

Android: Create a toggle button with image and no text

人盡茶涼 提交于 2019-11-27 06:02:59
is it possible to create a toggle button in Android that has an image but no text? Ideally it would look like this: Ive seen similar posts where the answer was to change the background but i want to preserve the Holo Light layout and just swap the text with an image. I need to be able to programaticallly change the image source, Any ideas how i would make this? If this cant be done, is there a way i can make a normal button toggle on and off? Rachit Mishra Can I replace the toggle text with an image No, we can not, although we can hide the text by overiding the default style of the toggle

How to make a radio button look like a toggle button

戏子无情 提交于 2019-11-26 23:49:21
问题 I want a group of radio buttons to look like a group of toggle buttons (but still function like radio buttons). It's not necessary that they look exactly like toggle buttons. How can I do this only with CSS and HTML? EDIT: I will be satisfied making the little circle disappear and changing the style when the button is checked/unchecked. 回答1: Depending on which browsers you aim to support, you could use the :checked pseudo-class selector in addition to hiding the radio buttons. Using this HTML

Android: Specify two different images for togglebutton using XML

南笙酒味 提交于 2019-11-26 23:35:28
I'm attempting to override the default ToggleButton appearance. Here's the XML that defines the ToggleButton : <ToggleButton android:id="@+id/FollowAndCenterButton" android:layout_width="30px" android:layout_height="30px" android:textOn="" android:textOff="" android:layout_alignParentLeft="true" android:layout_marginLeft="5px" android:layout_marginTop="5px" android:background="@drawable/locate_me"/> Now, we have two 30 x 30 icons we want to use for the clicked/non-clicked states. Right now we have code that programmatically changes the background icon depending on the state: centeredOnLocation

Android MenuItem Toggle Button

孤街浪徒 提交于 2019-11-26 21:21:10
问题 In my Android application, I want a setting to be toggleable in it's menu like the Dialer app does for speaker and mute. You can see a picture below: http://www.isaacwaller.com/images/acall.png You see how the Speaker, Mute and Hold options are toggle buttons - you can tap them again and they will toggle the green color. They may do this in a custom way, but I suspect it is a option (I tried setting the Checkable attribute). 回答1: It's looks like this menu item is implemented as a custom view.

Toggle button using two image on different state

北城余情 提交于 2019-11-26 18:21:21
I need to make a toggle button using two image instead of ON/OFF state. At off state i set a background image.But the OFF text can not removed while i use background image. And i can not set another image on ON state by clicking the toggle button :( I am new in android. I hope you guys help me get out of this problem AkashG Do this: <ToggleButton android:id="@+id/toggle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/check" <!--check.xml--> android:layout_margin="10dp" android:textOn="" android:textOff="" android:focusable="false" android

Multi-State Toggle Button

笑着哭i 提交于 2019-11-26 16:15:42
问题 In the app I've been working on, I would like to have a multiple-state (in my case, three) toggle button, instead of the two that ToggleButton provides. I've tried to start my own that extends Button , following the CompoundButton source, but quite honestly reading over its source got a bit overwhelming. Is there a way to do a three-state toggle button using just a selector xml or something, or perhaps another method I haven't thought of? I'm rather at a loss of how to do this. 回答1: You can

Change “on” color of a Switch

[亡魂溺海] 提交于 2019-11-26 15:06:28
I'm using a standard Switch control with the holo.light theme in a ICS app. I want to change the highlighted or on state color of the Toggle Button from the standard light blue to green. This should be easy, but I can't seem to work out how to do it. SubChord As of now it is better to use SwitchCompat from the AppCompat.v7 library. You can then use simple styling to change the color of your components. values/themes.xml: <style name="Theme.MyTheme" parent="Theme.AppCompat.Light"> <!-- colorPrimary is used for the default action bar background --> <item name="colorPrimary">@color/my_awesome

Android: Create a toggle button with image and no text

痞子三分冷 提交于 2019-11-26 11:51:03
问题 is it possible to create a toggle button in Android that has an image but no text? Ideally it would look like this: Ive seen similar posts where the answer was to change the background but i want to preserve the Holo Light layout and just swap the text with an image. I need to be able to programaticallly change the image source, Any ideas how i would make this? If this cant be done, is there a way i can make a normal button toggle on and off? 回答1: Can I replace the toggle text with an image

Android: Specify two different images for togglebutton using XML

南楼画角 提交于 2019-11-26 08:44:22
问题 I\'m attempting to override the default ToggleButton appearance. Here\'s the XML that defines the ToggleButton : <ToggleButton android:id=\"@+id/FollowAndCenterButton\" android:layout_width=\"30px\" android:layout_height=\"30px\" android:textOn=\"\" android:textOff=\"\" android:layout_alignParentLeft=\"true\" android:layout_marginLeft=\"5px\" android:layout_marginTop=\"5px\" android:background=\"@drawable/locate_me\"/> Now, we have two 30 x 30 icons we want to use for the clicked/non-clicked