我正在尝试使用我的drawable-hdpi文件夹中的图像来编程设置应用程序的背景。但是它只能看到R.drawable中的默认ic_launcher文件,因此当我去设置背景时,它根本不存在。我将此类用作片段类,并带有滑动菜单,所以可能与此有关。注:我能够在我的xml文件中设置背景,但无法在我的oncreateview方法中设置背景。
public class inputClass extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.input_xml, container, false);
rootView.setBackgroundResource(R.drawable.hidden);
return rootView;
}