如何使用twowayview加载图片?

时间:2015-08-14 09:42:11

标签: android

我尝试在mu android应用程序中通过twowayview加载图像,我该怎么办? 我可以加载文本,但当我尝试在我的适配器中加载图像时,我有错误,说设置文本的ID! 我加载图片的代码是:

    public View onCreateView(LayoutInflater inflater, ViewGroup container,

        Bundle savedInstanceState) {
    View view = null;
    View rootView = inflater.inflate(R.layout.fragment2, container, false);

    twoWayView  = (TwoWayView)rootView.findViewById(R.id.twoWayView);
    ArrayList<Integer> items = new ArrayList<Integer>();
    items.add(R.drawable.action_about);
    items.add(R.drawable.action_about);

    ArrayAdapter<Integer> aItems = new ArrayAdapter<Integer>(getActivity(), R.layout.simple_list_item_2, items);

    twoWayView.setAdapter(aItems);
    return rootView;

0 个答案:

没有答案