Fragment切换的时候透明的


切换代码
getFragmentManager().beginTransaction()
.addToBackStack("T")
.replace(R.id.mainFragment, new TranslationFragment())
.commit();
fragment代码
public class TranslationFragment extends Fragment implements OnClickListener {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreateView(inflater, container, savedInstanceState);
View v = inflater.inflate(R.layout.fragment_translation, container,false);
v.setAlpha(1);
v.findViewById(R.id.btnStartTranslationByCode).setOnClickListener(this);
v.findViewById(R.id.btnStartTranslationByXml).setOnClickListener(this);
return v;
}
...
}
------解决思路----------------------

------解决思路----------------------
有没有设置一下R.layout.fragment_translation里的背景颜色试试。
我的自定义fragment,直接定义背景是可以的。