0

工作如何與VideoViewFragments如何使用VideoView和片段

public class Tab2 extends Fragment implements View.OnClickListener { 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
          Bundle savedInstanceState) { 
     View rootView = inflater.inflate(R.layout.tab2, container, false); 
     Button play = (Button)rootView.findViewById(R.id.play); 
     VideoView vid = (VideoView) rootView.findViewById(R.id.videoView); 
     return rootView; 
    } 

@Override 
public void onClick(View view) { 
    switch (view.getId()){ 
     case R.id.play: 
    String videopath = "android.resource://" + getPackageName() + "/" + R.raw.prod; 
    Uri uri = Uri.parse(videopath); 
    vid.setVideoURI(uri); 
    vid.start(); 
} 

} 
} 

enter image description here

+0

什麼是你有錯誤或問題? –

回答

0

工作試試這個JavaScript函數:

function Onselectvideo() 
{  
    var openPage = "/ttk/images/Healtheaze.mp4"; 
    //var openPage = "/OnlineHomeAction.do"+partmeter; 
    var w = screen.availWidth - 10; 
    var h = screen.availHeight - 49; 
    var features = "scrollbars=0,status=1,toolbar=0,top=0,left=0,resizable=0,menubar=no,width="+w+",height="+h; 
    window.open(openPage,'',features); 
}