1.一般情况下:
下划线处报错
public class MainTab_2 extends Fragment
{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
return inflater.inflate(R.layout.main_tab02, container, false);
stopFlags.value=false;
TextView tw=(TextView)<u>findViewById</u>(R.id.textView1);
Button btn=(Button)<em>findViewById</em>(R.id.button1);
......
}
}
public class MainTab_2 extends Fragment
{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
<u>这一步非常关键:
<span style="color:#ff0000;">View messageLayout= inflater.inflate(R.layout.time_counter, container, false);</span></u>
stopFlags.value=false;
<u>tw=(TextView)<span style="color:#ff0000;">messageLayout.</span> findViewById(R.id.textView1);
btn=(Button)<span style="color:#ff0000;">messageLayout.</span>findViewById(R.id.button1);</u>
......
}
}