attr

Android Custom Control namespace issue

匆匆过客 提交于 2020-01-02 03:00:49
问题 I've been working on a Custom Control for Android and although I tried to do what's suggested here there seems to be something I'm doing wrong. Here's my code to see if anyone can spot the problem: MyComponent.java public MyComponent(Context context, AttributeSet attrs) { super(context); TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.MyComponent); CharSequence myId = arr.getString(R.styleable.MyComponent_identifier); if (myId != null) { this.setIdentifier(myId.toString());

Set switchStyle - get error resource not found - why?

☆樱花仙子☆ 提交于 2020-01-01 02:10:06
问题 I ran into a strange Problem: I am creating a style for an app and I set: <item name="android:spinnerStyle">@style/CustomSpinnerAppearance</item> <item name="android:textViewStyle">@style/CustomTextViewAppearance</item> <item name="android:buttonStyle">@style/CustomButton</item> Now I wanted to set: <item name="android:switchStyle">@style/CustomSwitch</item> And I get this error. No resource found that matches the given name: attr 'android:switchStyle'. I have checked in API-Lvl 14 and 15

Open all links in new tabs with jQuery

柔情痞子 提交于 2019-12-30 08:10:39
问题 I have some links that are placed in my page dynamically via JSON and have no way to directly edit them. I want to force all links to open in new tabs, ala target="_blank" Thought this would work.. but sadly it isn't. Any ideas? $('a').attr("target","_blank"); Here's a jsFiddle with the dynamic code: http://jsfiddle.net/danielredwood/mrgta/7/ 回答1: You could do this (which lets the users browser decide whether to open a new window or tab) $('a').live('click', function() { window.open($(this)

How do I add selectableItemBackground to an ImageButton programmatically?

痴心易碎 提交于 2019-12-28 05:35:08
问题 android.R.attr.selectableItemBackground exists, but how do I add it programatically to an ImageButton? Also, how would I go about finding the answer in the documentation? It's mentioned here, but I don't see any explanation of how it's actually used. Actually, I rarely seem to find the documentation useful, but I'm hoping that's my fault and not that of the documentation. 回答1: Here is an example using answer here: How to get the attr reference in code? // Create an array of the attributes we

Does the attr() in jQuery force lowercase?

牧云@^-^@ 提交于 2019-12-28 04:22:29
问题 I'm trying to manipulate the svg 'viewBox' attribute which looks something like this: <svg viewBox="0 0 100 200" width="100" ...> ... </svg> Using $("svg").attr("viewBox","..."); However, this creates a new attribute in the element called "viewbox". Notice the lowercase instead of intended camelCase. Is there another function I should be using? 回答1: I was able to use pure javascript to get the element and set the attribute by using var svg = document.getElementsByTagName("svg")[0]; and svg

Python: How to sort a list of objects using attrgetter with case insensitivity

∥☆過路亽.° 提交于 2019-12-24 18:00:10
问题 self.data = sorted(self.data, key=attrgetter('word')) self.data is a list of Word objects. Word objects have 'word', 'definition', 'example' and 'difficulty' attributes. I want to sort by the 'word' strings of each Word object, and the code above does that except it's not case insensitive. How would I go about making the sorting case insensitive? I've tried the solutions from another question asked here, but when I tried it, it said "TypeError: 'Word' object is not subscriptable". What could

Autocomplete textarea text after click result on list jquery

别来无恙 提交于 2019-12-24 09:58:46
问题 I'm making a textarea for users to create posts. In those posts they have the possibility to tag someone @myfriend . I successfully with @NiMusco help, developed the jquery code, but what I'm getting into trouble at the moment of autocompleting after clicking one of the results, for example replace @Jean (listed result) by @Je written within the textarea. <textarea id=inline_search></textarea> <div > <ul id=show_inline_users> </ul> </div> The php outputs json data, this type $arr[] = array(

Ruby OOP tic-tac-toe hash / conditional / itiration

喜欢而已 提交于 2019-12-24 08:20:06
问题 Trying to create a classic tic tac toe OOP in Ruby but am having trouble with my game_results() method. I realize this is not really complete and needs some more functionality but for now im just trying to fill my board with the inputted objects from the user and outputting the filled board and winner. When I can see on my board that we have a winner I call for the game_results() method and it gives me the correct winner but whenever a tie game occurs, I receive a error. Anybody got any ideas

Get the next href in a list in another file with jQuery?

馋奶兔 提交于 2019-12-24 02:18:37
问题 I've searched and searched, and it seems I'm stuck on this problem. Somehow I thought this wouldn't be too hard, and it probably isn't for anyone with a little more knowledge about jQuery. I have an .html file, lets call it "originalfile.html", with a couple of lists, something like this: <div id="content"> <ul id="firstlist"> <li class="link1"><a href="/path/link1.html" target="_blank"></a></li> <li class="link2"><a href="/path/link2.html" target="_blank"></a></li> <li class="link3"><a href=

jquery attr add id to existing element

六月ゝ 毕业季﹏ 提交于 2019-12-24 00:57:03
问题 I have a bunch of imgs inside a div with a class on them, in my JS I have a for loop that re-sizes the images to fir inside a box without stretching $('.gallery img')[i].attr('id', 'img' + i); This is what I tried to get each img to have its own id like 'img1' 'img2' 'img3' etc but it seems to not work 回答1: Replace your for loop with: $('.gallery img').each(function(i) { $(this).attr('id', 'img' + i); // You can also add more code here if you wish to manipulate each IMG element further });