当我尝试在菜单中更新我的MenuItem时,我收到了IndexOutOfBoundsException.
我在xml中添加了menu_item,当enable()== false时我可以看到它.
我的代码:
public boolean onPrepareOptionsMenu(Menu menu) {
if ( enable() ) {
MenuItem menuItem= menu.getItem(R.id.menu_item);
menuItem.setEnabled(true);
}
return super.onPrepareOptionsMenu(menu);
}
Run Code Online (Sandbox Code Playgroud)
如何处理这个问题?
干杯.
我正在编写一个游戏AI引擎,我想在一个数组中存储一些lambda表达式/委托(多个参数列表).
像这样的东西:
_events.Add( (delegate() { Debug.Log("OHAI!"); }) );
_events.Add( (delegate() { DoSomethingFancy(this, 2, "dsad"); }) );
Run Code Online (Sandbox Code Playgroud)
在C#中有可能吗?
我正在尝试使用Qt制作游戏,因为它太棒了;)而且你拥有免费所需的所有东西.唯一的问题是更改系统分辨率和设置QWidget(或QGLWidget)"真实"全屏.
有没有人设法做过这样的事情?这种方法的可移植性如何?我想在所有桌面系统上部署我的应用程序.
也许使用SDL或像SMFL这样的全屏?
请分享你的黑客!
干杯.
我在Android中遇到了Listview的问题.然后我尝试将适配器设置为listview我得到资源未找到异常.
我的代码:
public class MyActivity extends Activity {
ArrayList<String> list;
public void onCreate(Bundle savedInstanceState) {
list = new ArrayList<String>();
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
list.add("first");
listView = (ListView)findViewById(R.id.CheckpointList);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.id.CheckpointList, list);
listView.setAdapter(adapter);
}
}
Run Code Online (Sandbox Code Playgroud)
在我的main.xml中,我得到了:
<ListView android:id="@+id/CheckpointList" android:layout_height="wrap_content" android:layout_width="fill_parent"></ListView>
Run Code Online (Sandbox Code Playgroud)
我试图清理和改造项目 - 没有影响......
如何解决这个问题呢?
干杯.