[英]How can I add button function into fragments
做這樣的事情
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;
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.