Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当用户选择一个菜单选项时,我在 onMenuItemSelected 中捕获它,然后调用
findViewById(R.id.xyz).setVisibility(View.VISIBLE);
但是视图不会变得可见。我尝试了各种方法来强制重绘,但它就是不会重绘。
想法?
可能将其转换为任何类型的对象,例如它是一个按钮:
((Button)findViewById(R.id.xyz)).setVisisibility(View.VISIBLE);
我知道我会尝试,甚至:
Button b = (Button)findViewById(R.id.xyz); b.setVisibility(View.VISIBLE);
但是,它可能与您的 Z 顺序有关。您可能正在以一种奇怪的方式绘制它们,所以它正在被绘制,但只是在另一个视图下方?让我们发布,我相信你会找到解决方案的!