java.lang.NoSuchMethodError:setBackground()(java.lang.NoSuchMethodError: setBackground())
在我的应用程序中,我正在尝试将位图图像设置为
FrameLayout
,其中图像来自SQLite
数据库。 我正在解码该图像将其转换为Drawable
,然后将其设置为FrameLayout
背景,但它给出了我的错误,如java.lang.NoSuchMethodError: android.widget.FrameLayout.setBackground()
ByteArrayInputStream imageStream2= new ByteArrayInputStream(cardbackground); Bitmap Imagebackground = BitmapFactory.decodeStream(imageStream2); Drawable imagebakground=new BitmapDrawable(getResources(),Imagebackground); framelayout.setBackground(imagebakground);
我在用着,,
android:minSdkVersion="14" android:targetSdkVersion="19"
In my app I'm trying to set a Bitmap Image to
FrameLayout
, where the image came fromSQLite
database. I'm decoding that image converting it intoDrawable
and then setting it as background toFrameLayout
but it gives me Error likejava.lang.NoSuchMethodError: android.widget.FrameLayout.setBackground()
ByteArrayInputStream imageStream2= new ByteArrayInputStream(cardbackground); Bitmap Imagebackground = BitmapFactory.decodeStream(imageStream2); Drawable imagebakground=new BitmapDrawable(getResources(),Imagebackground); framelayout.setBackground(imagebakground);
I'm using,,
android:minSdkVersion="14" android:targetSdkVersion="19"
原文:https://stackoverflow.com/questions/22350868
更新时间:2024-03-06 18:03
最满意答案
相关问答
更多-
更换 var value = $(this).val(); 通过 var value = String.fromCharCode(e.which) || e.key; 毕竟, 在允许在字段中输入字符之前 ,您需要检查已按下哪个键。 此外,请确保不阻止退格键和删除按钮和箭头键! $(function() { var regExp = /[a-z]/i; $('#test').on('keydown keyup', function(e) { var value = String.fr ...
-
您可以使用isNaN函数确定值是否不转换为数字。 示例如下: function checkInp() { var x=document.forms["myForm"]["age"].value; if (isNaN(x)) { alert("Must input numbers"); return false; } } You can use the isNaN function to determine if a value does not convert to a ...
-
使用IF ELSE语句检查输入是否只是javascript中的字母(Check if input is only alphabets in javascript using IF ELSE statement)[2023-01-22]
您可以使用正则表达式( RegExp )检查它,特别是使用.test()函数: if(/[^a-zA-Z]/.test(x)) // code to throw error 如果x包含任何非字母字符,这将运行代码以引发错误。 You can check it using regular expressions (RegExp), specifically with the .test() function: if(/[^a-zA-Z]/.test(x)) // code to throw ... -
如果要取消事件,则需要使用preventDefault() ,即禁止文本框接受非数字输入。 这样你就不用担心删除它了。 但是, preventDefault()不能与onkeyup 。 使用onkeydown 。 JS : function checkKey(e) { if (e.keyCode != 8 && // allow backspace e.keyCode != 46 && // allow delete e.keyCode != 37 && // al ...
-
javascript:if语句(javascript:if statement)[2023-06-17]
听起来您正在寻找逻辑异或(XOR)操作。 这里有一些Javascript示例。 我最喜欢的(出乎意料和简单)是: if (foo ? !bar : bar) { ... } 不可否认,这是一个不寻常的编码,并且接近“过于聪明”。 有时,如果一种语言没有操作的直接语法,则代码必须是冗长的,比如从除法运算中获取商和余数。 It sounds like you are looking for a logical exclusive-or (XOR) operation. There are some J ... -
你需要通过document.getElementById("numSpots").value获得#numbSpots的值document.getElementById("numSpots").value function myFunction() { var numSpots = document.getElementById("numSpots").value; var adaSpots; if (numSpots < 25) { adaSpots = "1"; } el ...
-
正则表达式的所有字母(Regex for all alphabets)[2022-03-06]
如果您使用的是Java(不是JavaScript!),则可以使用unicode属性,例如 \P{L}来自任何语言的任何类型的信件。 有关更多信息,请参阅regular-expressions.info/unicode 。 对于Javascript: 有一个来自XRegExp的lib和一些插件XRegExp Unicode插件 ,它们扩展了javasript正则表达式的特性。 这增加了对Unicode类别,脚本和块的支持。 使用这些库,您可以在JavaScript中使用\p{L} 。 以一个小例子查看我对这个 ... -
由此判断: $ help select select: select NAME [in WORDS ... ;] do COMMANDS; done The WORDS are expanded, generating a list of words. The set of expanded words is printed on the standard error, each preceded by a number. [...] 我担心你想要的是不可能的。 选项将被编号, ...
-
每次选择ID时,都需要记住使用ID选择器# 。 你需要使用$('#example, #example2')而不是$('#example, example2') 。 Each time you are selecting an ID, you need to remember to use the ID selector #. You need to use $('#example, #example2') instead of $('#example, example2').
-
假设“仅包含字母”意味着最后三个字符是字母az的组合: var str = '245545g65'; if (/[a-z]{3}$/.test(str)){ // last three characters are any combinations of the letters a-z alert('Only letters at the end!'); } assuming that "contains only alphabets" means the last three character ...