我的问题是加载XML中定义的字符串数组在应用程序中工作,但会导致ADT图形布局预览中的错误.
现在,由于此错误,我无法在图形布局中看到任何图形,并且很难与其他图形一起使用.但是如果我构建并运行我的应用程序,视图正在加载并显示字符串.
所以我想我的代码是正确的但是:
我有一个自定义视图,我在array.xml文件中获取由我定义的数组.
public class ScoreTable extends View {
[...]
@Override
protected void onDraw(Canvas canvas) {
[...]
int score_vals[] = getResources().getIntArray(R.array.score_vals);
[...]
}
[...]
}
Run Code Online (Sandbox Code Playgroud)
我的数组在res/values/array.xml中定义:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="score_vals">
<item >10</item>
<item >20</item>
<item >50</item>
</array>
</resources>
Run Code Online (Sandbox Code Playgroud)
图形布局为空白,并说:
Int array resource ID #0x7f050000
Exception details are logged in Window > Show View > Error Log
Run Code Online (Sandbox Code Playgroud)
但当然我有"public static final int score_vals = 0x7f050000;" 在R.java!
此错误的详细信息是50深度堆栈,但重新开始:
android.content.res.Resources$NotFoundException: Int array resource ID #0x7f050000
at android.content.res.Resources.getIntArray(Resources.java:405)
at com.threecats.poker.ScoreTable.onDraw(ScoreTable.java:53) …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中登录facebook按钮和发布按钮,当我使用它,它工作正常,但当我去布局我发现这个错误,我不知道什么意思...
我需要一个线索知道如何继续
这个错误来自布局
Exception raised during rendering: Could not resolve resource value: 0x7F08000A.
Exception details are logged in Window > Show View > Error Log
The following classes could not be instantiated:
- com.facebook.widget.LoginButton (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse
android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F070004.
at android.content.res.BridgeResources.throwException(BridgeResources.java:693)
at android.content.res.BridgeResources.getColor(BridgeResources.java:185)
at com.facebook.widget.LoginButton.<init>(LoginButton.java:204)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0( at …Run Code Online (Sandbox Code Playgroud)