我有一个应用程序,我在屏幕底部有一个toolbarmanager来控制显示哪个屏幕.工具栏非常适合触摸,但它不可调焦.我尝试用可聚焦的风格创建它但没有运气.
到目前为止我尝试过:tbm = new ToolbarManager(Manager.FOCUSABLE);
额外细节:
现在,当我尝试将FOCUSABLE添加到ToolbarButtonField时,整个工具栏都会消失.不知道为什么会这样.
有任何想法吗?
您无法将焦点设置为管理器,您必须为其中的字段设置焦点.现在,对于ToolbarManager,您可以使用ToolbarButtonField并将其设置为焦点,这样管理员就可以集中注意力.
您可以使用以下方法解决它.
ToolbarManager mana = new ToolbarManager();
ToolbarButtonField test = new ToolbarButtonField(){
public boolean isFocusable() {
return true;
}
protected void onFocus(int direction) {
super.onFocus(direction);
invalidate();
}
protected void onUnfocus() {
super.onUnfocus();
invalidate();
}
};
test.setText(new StringProvider("AAAA"));
mana.add(test);
add(mana);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
276 次 |
最近记录: |