2017-03-22 65 views
1

我使用选项卡式活动创建应用,并且希望将YouTube播放器放在第三个选项卡上。YouTube Player选项卡式活动

目前我有这样的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播放器里面的片段,特别是在像这样的选项卡式的活动?

谢谢

回答

1

您的FragmentTutorial应扩展YouTubePlayerFragment。

相关问题