【发布时间】:2013-03-29 05:29:15
【问题描述】:
这是我为实现 CommonsWare 在以下问题中的回答所做的: How do I create a help overlay like you see in a few Android apps and ICS?
但它失败了。运行时没有错误但没有出现任何错误(我已确保下面的 isFirstTime() 函数运行正常
@Override
public void onCreate(Bundle savedInstanceState)
{
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
if(isFirstTime())
{
LayoutInflater inflater = LayoutInflater.from(this);
final FrameLayout overlayFrameLayout = new FrameLayout(this);
setContentView(overlayFrameLayout);
overlayFrameLayout.addView(inflater.inflate(R.layout.main, null));
overlayFrameLayout.addView(inflater.inflate(R.layout.overlay, null));
overlayFrameLayout.setVisibility(View.VISIBLE);
overlayFrameLayout.setOnTouchListener(new View.OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
overlayFrameLayout.setVisibility(View.INVISIBLE);
overlayFrameLayout.removeViewAt(1);
return false;
}
});
}
setContentView(R.layout.main);
ctx = getApplicationContext();
我很确定我在创建 FrameLayout 时出错了。感谢您的帮助,谢谢!
【问题讨论】:
标签: android xml layout user-interface overlay