Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weex怎么加载到Fragment? #2593

Closed
luckyjay09 opened this issue Feb 16, 2017 · 9 comments
Closed

Weex怎么加载到Fragment? #2593

luckyjay09 opened this issue Feb 16, 2017 · 9 comments

Comments

@luckyjay09
Copy link

Android使用原生导航栏 怎么让Weex渲染加载到当前Activity的Fragment中
官方只有Activity的Weex实现

@CCC2016
Copy link

CCC2016 commented Feb 16, 2017

MainActivity 实现 AbstractWeexActivity
MainActivity 中使用 FragmentTabHost 实现导航,

加载到 Fragment 中渲染:

MainActivity mainActivity = (MainActivity) getActivity();

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
    @Nullable Bundle savedInstanceState) {
    mainActivity.setContainer(customView);
    return customView;
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mainActivity.renderPage(WXFileUtils.loadAsset("more-lists.js", getContext()));
}

😁

@luckyjay09
Copy link
Author

luckyjay09 commented Feb 16, 2017

AbstractWeexActivity不是抽象类吗 为什么是实现它?
楼上有没有完整点的代码 我撸不出来啊
直接用用最普通的V4包的Fragment通过按钮replace()方法 切换不同的fragment可以实现吗
还有customView是哪里来的

@CCC2016
Copy link

CCC2016 commented Feb 20, 2017

Activity 集成 AbstractWeexActivity就好了,AbstractWeexActivity 虽然是抽象类,但没有抽象方法,不需要做额外处理;
customView 只需是 ViewGroup 子类即可;
你看一遍官方 AbstractWeexActivity 类的代码就会懂了。
🙂

@kevinTutu
Copy link

同问 现在如何将Weex渲染加载到当前Activity的Fragment中

@Tomdoog
Copy link

Tomdoog commented Oct 10, 2017

一样我也想问,怎么把 js 渲染到fragment里 求大神啊

@shinyjacklee
Copy link

Hi guys, try this demo weex-start-kit to see how to load weex page in Fragment(Android)

@YorkShen
Copy link
Contributor

This PR/issue doesn't received response since Weex migrated to Apache two years ago and this repository is no longer active yet.

Feel free to ask question in new repository and thanks for your contribution.

@Hanks10100
Copy link
Member

This issue is outdated for a long time and will be closed now. You can create a new one if you still have questions.

@lihongyang166
Copy link

这个问题是否解决了,目前也遇到此类问题,参考[weex-start-kit]无法解决,是否可以给与一些帮助

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants