selector

Dynamically defining and using selectors

一世执手 提交于 2019-11-27 18:33:45
问题 I have a ListView which has custom elements inside of it. I want to create selectors for each of those elements. Selectors themselves will not be very complicated because they need to handle only background color while item is hovers/selected/etc. However colors for those selectors have to come from external source that is I need to be able to set them from variables, so some simple static code will not do. How to define sector with all it`s parameters programmatically? How to assign that

javascript selectors

我的未来我决定 提交于 2019-11-27 18:09:39
问题 How does one select DOM elements in javascript? Like for example: <div class="des"> <h1>Test</h1> <div class="desleft"> <p>Lorem Ipsum.</p> </div> <div class="Right"> <button>Test</button> </div> </div> Now how do i select h1 ? This is just a part of a bigger Page, so cannot use getElementsByTagName() , since others might get selected. Also since there might be other h1 's in the document later, i cannot attach the index(body's) to above. Is there a simple way to select, say <h1> tag which is

Android: textColor of disabled button in selector not showing?

妖精的绣舞 提交于 2019-11-27 17:19:28
I am trying to make a button with a selector my button can have the following states: Enabled/Disabled Pressed/Not Pressed According to the states mentioned above. I need to manipulate the button's: Text color background image The button starts off my being disabled so it should have the disabled textColor and the disabled button background. But I can see the default textColor (specified in style) and NO background image! Here is my selector button_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state

Java NIO client

微笑、不失礼 提交于 2019-11-27 15:54:42
import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.*; public class EchoServer { private InetAddress addr; private int port; private Selector selector; private Map<SocketChannel,List<byte[]>> dataMap; public EchoServer(InetAddress addr, int port) throws IOException { this.addr = addr; this.port =

change color of selected listview item

↘锁芯ラ 提交于 2019-11-27 15:10:33
问题 I want to change color of list item when it will press For that I did like below, list_item_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> Selected <item android:state_focused="true" android:state_selected="false" android:drawable="@drawable/list_focused"/> Pressed <item android:state_selected="true" android:state_focused="false" android:drawable="@drawable/list_selected" /> </selector> I have set the color in colors

JQuery $(this) selector function and limitations

假装没事ソ 提交于 2019-11-27 13:45:57
I need help understanding $(this). Is it possible to narrow the focus of 'this' within the parentheses or does "this" preclude the use of any other attributes? For example: I don't understand why this code: $(this).children("div") can't be rewritten like this: $(this +" div") without having to resort to something like: $('#'+$(this).attr("id")+" div") Also, can you point me to 'this' in the JQuery documentation? It is difficult to use 'this' as a search term for obvious reasons. this isn't a jQuery "thing", but a basic JavaScript one . It can't be re-written the way you have in examples

Should I fix Xcode 5 'Semantic issue: undeclared selector'?

穿精又带淫゛_ 提交于 2019-11-27 12:20:45
问题 I'm trying to upgrade my app with Xcode5 but encountered a number of 'Semantic issues' in a third party library (being MagicalRecord). The quickest way to 'fix' this might be using the: #pragma GCC diagnostic ignored "-Wundeclared-selector" (from: How to get rid of the 'undeclared selector' warning) compiler directive, but my gut-feeling says this is not the appropriate way to do this. A small code sample with the above error: + (NSEntityDescription *) MR_entityDescriptionInContext:

Passing parameters to the method called by a NSTimer

点点圈 提交于 2019-11-27 10:55:06
How can I pass a parameter to the method called by a NSTimer? My timer looks like this: [NSTimer scheduledTimerWithTimeInterval:4 target:self selector:@selector(updateBusLocation) userInfo:nil repeats:YES]; and I want to be able to pass a string to the method updateBusLocation. Also, where am supposed to define the method updateBusLocation? In the same .m file that I create the timer? EDIT: Actually I am still having problems. I am getting the error message: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' * -[MapKitDisplayViewController updateBusLocation]:

Selectors in Objective-C?

﹥>﹥吖頭↗ 提交于 2019-11-27 10:14:08
First, I'm not sure I really understand what a selector is. From my understanding, it's the name of a method, and you can assign it to a class of type 'SEL' and then run methods such as respondToSelector to see if the receiver implements that method. Can someone offer up a better explanation? Secondly, to this point, I have the following code: NSString *thing = @"Hello, this is Craig"; SEL sel = @selector(lowercaseString:); NSString *lower = (([thing respondsToSelector:sel]) ? @"YES" : @"NO"); NSLog (@"Responds to lowercaseString: %@", lower); if ([thing respondsToSelector:sel]) //(lower == @

Android: How to Make A Drawable Selector

▼魔方 西西 提交于 2019-11-27 09:01:22
I feel like this is kind of a silly question, but here I go anyways. I have an image button, and I want to be able to change it's image everytime it is clicked. The API seems to say that the best way to go about doing this is to create xml resource in the drawable folder that contains a selector and values. However when I go to make a new android xml resource, there's no option for drawables. What am I missing? As far as I know, the Android XML editor doesn't allow you to create XML drawables. You have to go to the source tab (labeled: filename.xml) and paste in the text manually. It should