【发布时间】:2016-04-26 16:03:05
【问题描述】:
我正在尝试在片段中调用库,但不知道如何在片段中设置它我已在主要活动中完成,但在片段中设置 setContentView 时出错 编译依赖
compile 'com.github.medyo:android-about-page:1.0.2'
我的片段内容视图
@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;
}
我在倒数第二行遇到错误,如何解决这个问题。 以下库将在 api 20+ 中工作 图书馆https://github.com/medyo/android-about-page
【问题讨论】:
标签: android android-fragments setcontentview