在tablelayout中插入视频

时间:2018-05-09 19:18:03

标签: java android android-layout

我正在尝试在 tablelayout 中插入视频,但活动未在运行

谁能告诉我有什么问题?如果可能,有没有办法做到这一点?谢谢

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sang);

        tabLayout=(TabLayout)findViewById(R.id.layouttab);
        tabLayout.addTab(tabLayout.newTab().setText("Don du sang"));

        tabLayout.addTab(tabLayout.newTab().setText("recepteur du sang"));
        tabLayout.getTabAt(0).setIcon(R.drawable.hee);

        tabLayout.getTabAt(1).setIcon(R.drawable.volunteering);
        pager=(ViewPager)findViewById(R.id.pagg);
        PagerAdapter pagerAdapter=new PagerAdapter(getSupportFragmentManager(),tabLayout.getTabCount());
        pager.setAdapter(pagerAdapter);

        pager.setOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
        tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                pager.setCurrentItem(tab.getPosition());

            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

              /*  videoView=(VideoView)findViewById(R.id.sauve);
                videoView.setVideoPath("android.resource://"+getPackageName()+"/"+R.raw.sensibilisation);*/

            }

0 个答案:

没有答案