android.widget.FrameLayout frameLayout = new android.widget.FrameLayout(this);
android.widget.FrameLayout.LayoutParams layoutParamsForFrameLayout = new android.widget.FrameLayout.LayoutParams(android.widget.FrameLayout.LayoutParams.MATCH_PARENT, android.widget.FrameLayout.LayoutParams.WRAP_CONTENT);
frameLayout.setLayoutParams(layoutParamsForFrameLayout);
frameLayout.setBackgroundColor(android.graphics.Color.LTGRAY);
android.widget.LinearLayout linearLayout = new android.widget.LinearLayout(this);
linearLayout.setId(index);
linearLayout.setTag(waybillDO.getWaybillNum());
linearLayout.setOnClickListener(this);
linearLayout.setOrientation(android.widget.LinearLayout.VERTICAL);
android.widget.LinearLayout.LayoutParams layoutParams = new android.widget.LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT);
//linearLayout.setDividerPadding(dip2px(this, 1));
//android.content.res.Resources resources = getResources();
//linearLayout.setDividerDrawable(resources.getDrawable(R.drawable.linear_layout_divider));
layoutParams.setMargins(dip2px(this, 0), dip2px(this, 1), dip2px(this, 0), dip2px(this, 1));
//linearLayout.setPadding(dip2px(this, 0), dip2px(this, 1), dip2px(this, 0), dip2px(this, 1));
linearLayout.setBackgroundColor(android.graphics.Color.WHITE);
linearLayout.setLayoutParams(layoutParams);
android.widget.TextView textViewWaybillNum = new android.widget.TextView(this);
android.widget.LinearLayout.LayoutParams layoutParamsForTextView = new android.widget.LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParamsForTextView.setMargins(dip2px(this, 10), dip2px(this, 4), dip2px(this, 10), dip2px(this, 0));
android.widget.LinearLayout.LayoutParams layoutParamsForSummary = new android.widget.LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParamsForSummary.setMargins(dip2px(this, 10), dip2px(this, 0), dip2px(this, 10), dip2px(this, 4));
textViewWaybillNum.setLayoutParams(layoutParamsForTextView);
java.sql.Timestamp timestamp = waybillDO.getWaybillReceiptDate();
java.util.Date date = new java.util.Date(timestamp.getTime());
java.lang.String waybillReceiptDate = dateFormat.format(date);
java.lang.String leftTopText = waybillDO.getWaybillNum() + " 出貨日期:" + waybillReceiptDate;
textViewWaybillNum.setText(leftTopText);
linearLayout.addView(textViewWaybillNum);
android.widget.TextView textViewWaybillScanSummary = new android.widget.TextView(this);
textViewWaybillScanSummary.setLayoutParams(layoutParamsForSummary);
java.lang.String leftBottomText = sSum + " " + sScanSum + " " + sTakeApartScanCount;
android.widget.ImageView imageView = new android.widget.ImageView(this);
if (sum == doneScan) {
imageView.setImageResource(R.drawable.ic_baseline_check_circle_24);
} else {
imageView.setImageResource(R.drawable.ic_baseline_circle_24);
}
textViewWaybillScanSummary.setText(leftBottomText);
textViewWaybillScanSummary.setTypeface(android.graphics.Typeface.defaultFromStyle(android.graphics.Typeface.BOLD));
textViewWaybillScanSummary.setTextSize(16.0f);
linearLayout.addView(textViewWaybillScanSummary);
frameLayout.addView(linearLayout);
android.widget.LinearLayout linearLayoutForImageAndDelete = new android.widget.LinearLayout(this);
linearLayoutForImageAndDelete.setOrientation(android.widget.LinearLayout.HORIZONTAL);
android.widget.TextView textViewForDelete = new android.widget.TextView(this);
textViewForDelete.setText("刪除");
textViewForDelete.setOnClickListener(this);
textViewForDelete.setTag(waybillDO.getWaybillNum());
linearLayoutForImageAndDelete.addView(imageView, 0);
linearLayoutForImageAndDelete.addView(textViewForDelete, 1);
android.widget.FrameLayout.LayoutParams layoutParamsForDelete = new android.widget.FrameLayout.LayoutParams(android.widget.FrameLayout.LayoutParams.WRAP_CONTENT, android.widget.FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParamsForDelete.gravity = android.view.Gravity.END | android.view.Gravity.CENTER_VERTICAL;
layoutParamsForDelete.rightMargin = dip2px(this, 10);
frameLayout.addView(linearLayoutForImageAndDelete, layoutParamsForDelete);
accordingToDriverDeliveryScanAdapter.addHeaderView(frameLayout, index);