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);
}
效果图:
黑色部分就是一个Dialog。