Android 将Activiyt作为Dialog弹出

在Androidmanifest.xml中加入如下主题

<activity
    android:name="com.example.mymeidaplay.Player"
    android:theme="@android:style/Theme.Dialog" >
</activity>

 在作为Dialog的Activity中做如下设置:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);
    //Remove notification bar
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
}

 效果图:

Android 将Activiyt作为Dialog弹出

黑色部分就是一个Dialog。

参考资料


本文转自Work Hard Work Smart博客园博客,原文链接:http://www.cnblogs.com/linlf03/archive/2013/06/13/3134303.html,如需转载请自行联系原作者

相关文章:

  • 2022-12-23
  • 2021-04-08
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2022-02-01
  • 2021-12-30
猜你喜欢
  • 2021-09-04
  • 2022-12-23
  • 2021-04-14
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
相关资源
相似解决方案