小编Nee*_*ava的帖子

如何在片段中设置setContentView

我试图在一个片段中调用一个库,但是不知道如何在一个片段中设置它我已经在主要活动中完成了但是我在我的片段中设置setContentView时遇到错误编译依赖

compile 'com.github.medyo:android-about-page:1.0.2'
Run Code Online (Sandbox Code Playgroud)

我的片段内容视图

  @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView  = inflater.inflate(R.layout.fragment_navigation, container, false);
    Element versionElement = new Element();
    versionElement.setTitle("Version 6.2");

    Element adsElement = new Element();
    adsElement.setTitle("Advertise with us");

    View aboutPage = new AboutPage(getActivity())
            .isRTL(false)
            .addItem(versionElement)
            .addItem(adsElement)
            .addGroup("Connect with us")
            .addEmail("elmehdi.sakout@gmail.com")
            .addFacebook("the.medy")
            .addTwitter("medyo80")
            .addYoutube("UCdPQtdWIsg7_pi4mrRu46vA")
            .addPlayStore("com.ideashower.readitlater.pro")
            .addInstagram("medyo80")
            .addGitHub("medyo")
            .create();

    setContentView(aboutPage);
    return rootView;
}
Run Code Online (Sandbox Code Playgroud)

我在倒数第二行得到错误如何解决这个问题.以下库可在api 20+库https://github.com/medyo/android-about-page中使用

android android-fragments setcontentview

0
推荐指数
1
解决办法
6343
查看次数