2017-04-02 8 views
0

アクティビティに3つのタブが表示される学習アプリケーションを作成しようとしていますが、私の質問はどのようにビデオビューをタブに配置できるかです。私が知っているボタンのコードは機能しません。それはフラグメントになると私はどのような構文を使用する必要がありますか? enter image description hereボタンの機能をフラグメントに追加するにはどうすればいいですか?

答えて

0

この

Public class Tab2Vid extand Fragment implement View.OnClickListener { 

    Public View onCreateView(LayoutInflater inflater, ViewGroup container 
          ,Bundle savedlnstanceState) { 

    View rootView = inflater.inflate(R.layout.tab2video, container, false); 

    Button play = (Button)rootView.findViewById(R.id.btnplay); 

    return rootView; 

    } 

    Public void onClick(View view)( 
    switch (view.getId()) 
     { 

      case R.id.btnplay: 
       Toast.makeText(getActivity(),"Btn Play clicked", Toast.LENGTH_SHORT).show(); 
       break; 
      default: 
       return; 
     } 
    } 
} 
ような何かを行います
関連する問題