コード例 #1
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    setHasOptionsMenu(true);

    check_back_or_not = false;

    View rootView = inflater.inflate(R.layout.qr_equipmentlist, container, false);

    getActivity().setTitle("Assets");

    MainActivity.global = 2;

    mListView = (ListView) rootView.findViewById(R.id.listforqr_equip);
    oehelper = new OEHelper(getActivity());
    List<String> k = oehelper.qr_equipmentname();

    List<String> img = oehelper.qr_equipmentimage();

    // items= new ArrayList<Object>(getItems());

    // mListAdapter = new OEListAdapter(getActivity(),R.layout.qr_equip_item, items)

    mListView.setAdapter(
        new ArrayAdapter<String>(getActivity(), R.layout.qr_equip_item, oehelper.qr_equip_name) {

          public View getView(int position, View convertView, ViewGroup parent) {
            View mView = convertView;

            if (mView == null)
              mView =
                  getActivity().getLayoutInflater().inflate(R.layout.qr_equip_item, parent, false);

            // IMAGE...
            /*
            OEDataRow row = (OEDataRow) items.get(position);


             ImageView imgPic = (ImageView) mView.findViewById(R.id.imgPic);
             Bitmap row1 =OEHelper.image_of_asset.get(QR_Equipment.position1);

             imgPic.setImageBitmap(row1);

            */

            TextView txv = (TextView) mView.findViewById(R.id.qr_name);
            Typeface font =
                Typeface.createFromAsset(getActivity().getAssets(), "fonts/Georgia.ttf");
            txv.setTypeface(font);
            txv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);

            txv.setTextColor(Color.rgb(84, 84, 84));

            if (OEHelper.qr_equip_name.size() != 0 && OEHelper.qr_equip_name.size() > position) {
              txv.setText("" + OEHelper.qr_equip_name.get(position));
            }
            // txv.setTextAppearance(getActivity(), android.R.attr.textAppearance);

            Log.i("ASSET NAME IS....:" + OEHelper.qr_equip_name, "THAT IS OK...NAMe..");
            return mView;
          }
        });

    mListView.setOnItemClickListener(this);
    // mListView.setAdapter(mListAdapter);
    return rootView;
  }