Android Open Source - BarcodeTest Utility






From Project

Back to project page BarcodeTest.

License

The source code is released under:

Copyright (c) 2014, zhongwcool All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * R...

If you think the Android project BarcodeTest listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.zxing.view;
//  w ww.  ja va 2s  .c o  m
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;

public class Utility {
    public static  void setListViewHeightBasedOnChildren(ListView listView) {
         //????ListView???Adapter
         ListAdapter listAdapter = listView.getAdapter();
         if (listAdapter == null) {
              return;
         }
               
         int totalHeight = 0;
         for (int i = 0, len = listAdapter.getCount(); i < len; i++) {   //listAdapter.getCount()??????????
              View listItem = listAdapter.getView(i, null, listView);
              listItem.measure(0, 0);  //?????View ???
              totalHeight += listItem.getMeasuredHeight();  //???????????
         }
               
         ViewGroup.LayoutParams params = listView.getLayoutParams();
         params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
         //listView.getDividerHeight()??????????????????
         //params.height????????ListView??????????
         listView.setLayoutParams(params);
   }
}




Java Source Code List

com.qr.activity.MainActivity.java
com.qr.activity.SearchResultActivity.java
com.qr.activity.WebviewActivity.java
com.qr.utils.Parser.java
com.zxing.activity.CaptureActivity.java
com.zxing.camera.AutoFocusCallback.java
com.zxing.camera.CameraConfigurationManager.java
com.zxing.camera.CameraManager.java
com.zxing.camera.FlashlightManager.java
com.zxing.camera.PlanarYUVLuminanceSource.java
com.zxing.camera.PreviewCallback.java
com.zxing.decoding.CaptureActivityHandler.java
com.zxing.decoding.DecodeFormatManager.java
com.zxing.decoding.DecodeHandler.java
com.zxing.decoding.DecodeThread.java
com.zxing.decoding.FinishListener.java
com.zxing.decoding.InactivityTimer.java
com.zxing.decoding.Intents.java
com.zxing.encoding.EncodingHandler.java
com.zxing.view.ResultUrlAdapter.java
com.zxing.view.Utility.java
com.zxing.view.ViewfinderResultPointCallback.java
com.zxing.view.ViewfinderView.java