【发布时间】:2017-08-14 16:36:19
【问题描述】:
我正在创建一个带有选项卡式活动的应用,我想将 YouTube 播放器放在第三个选项卡上。
目前我有这个java代码:
public class FragmentTutorial extends Fragment {
public FragmentTutorial() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_tutorial, container, false);
}
}
这是我的 XML:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.examplecom.FragmentTutorial">
</FrameLayout>
我的问题是……
大多数教程都尝试使用这个扩展语句:
public class FragmentTutorial extends YouTubeBaseActivity {
就我而言,我仍然需要 Fragment 作为扩展语句。如果更改为YouTubeBaseActivity,我的代码将无法运行。
知道如何在片段中安装 youtube 播放器,特别是在这样的选项卡式活动中吗?
谢谢
【问题讨论】:
标签: android android-fragments youtube