I added two tabs in the main activity layout, and created two java class, one for each tab. So I took the activity xml buttons from main activity and put it in the fragment layout, but I will use the find view by id in the java class of the fragment and it did not work.
public class FragmentA extends Fragment {
public ImageButton trans ;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate( R.layout.fragment_a, container, false );
trans = (ImageButton)findViewByID(R.id.imagem)
}
}