import android.widget.LinearLayout; //导入方法依赖的package包/类
public void addResultListItem(String title, String value, LinearLayout netLayout) {
final float scale = activity.getResources().getDisplayMetrics().density;
final int leftRightItem = Helperfunctions.dpToPx(5, scale);
final int topBottomItem = Helperfunctions.dpToPx(5, scale);
final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
final int heightDiv = Helperfunctions.dpToPx(1, scale);
final int topBottomImg = Helperfunctions.dpToPx(1, scale);
final LinearLayout netItemLayout = new LinearLayout(activity);
netItemLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT));
netItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem, topBottomItem);
netItemLayout.setGravity(Gravity.CENTER_VERTICAL);
final TextView itemTitle = new TextView(activity, null, R.style.listResultItemTitle);
itemTitle.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, 0.4f));
itemTitle.setWidth(0);
itemTitle.setGravity(Gravity.LEFT);
itemTitle.setText(title);
netItemLayout.addView(itemTitle);
final ImageView itemClassification = new ImageView(activity);
itemClassification.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.MATCH_PARENT, 0.1f));
itemClassification.setPadding(0, topBottomImg, 0, topBottomImg);
itemClassification.setImageDrawable(activity.getResources().getDrawable(
R.drawable.traffic_lights_none));
netItemLayout.addView(itemClassification);
final TextView itemValue = new TextView(activity, null, R.style.listResultItemValue);
itemValue.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, 0.5f));
itemValue.setWidth(0);
itemValue.setGravity(Gravity.LEFT);
itemValue.setText(value);
netItemLayout.addView(itemValue);
netLayout.addView(netItemLayout);
final View divider = new View(activity);
divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv,
1));
divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);
divider.setBackgroundResource(R.drawable.bg_trans_light_10);
netLayout.addView(divider);
netLayout.invalidate();
}