代码:
View initview = activityToView(context, new Intent(context, MainActivity.class));
public static View activityToView(ActivityGroup parent, Intent intent) { LocalActivityManager mLocalActivityManager = parent.getLocalActivityManager(); final Window w = mLocalActivityManager.startActivity("id", intent); final View wd = w != null ? w.getDecorView() : null; if (wd != null) { wd.setVisibility(View.VISIBLE); wd.setFocusableInTouchMode(true); ((ViewGroup) wd) .setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); } return wd; }
版权声明:本文为GXL_1899原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。