示例#1
0
  private LayoutParams getCurLayoutParams() {

    LinearLayout.LayoutParams layoutParams =
        new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, Tool.dip2px(getContext(), 35));
    layoutParams.topMargin = Tool.dip2px(getContext(), 1);
    return layoutParams;
  }
示例#2
0
  private LinearLayout getTitleView(Context context, AlertType type) {
    this.context = context;

    LinearLayout mainLine = new LinearLayout(context);
    mainLine.setOrientation(LinearLayout.HORIZONTAL);
    LayoutParams layoutParams =
        new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    mainLine.setLayoutParams(layoutParams);
    mainLine.setPadding(
        Tool.dip2px(context, 10),
        Tool.dip2px(context, 10),
        Tool.dip2px(context, 10),
        Tool.dip2px(context, 10));
    mainLine.setGravity(Gravity.CENTER_VERTICAL);

    mainLine.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.toast_background));

    ImageView imageView = new ImageView(context);
    if (type == AlertType.ERR) {
      imageView.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.err));
    } else if (type == AlertType.INFO) {
      imageView.setBackgroundDrawable(
          context.getResources().getDrawable(R.drawable.radio_bt_selected));
    } else {
      imageView.setBackgroundDrawable(null);
    }
    mainLine.addView(imageView);

    textView = new TextView(context);
    textView.setTextColor(context.getResources().getColor(R.color.white));

    textView.setTextSize(16);
    mainLine.addView(textView);
    return mainLine;
  }
示例#3
0
  public RptTitle(Context context, String title) {
    super(context);
    this.setTextColor(Tool.getTextColor(context));
    this.setText(title);

    this.setTextSize(15);
    this.setPadding(Tool.dip2px(getContext(), 10), 1, Tool.dip2px(getContext(), 15), 1);
    this.setGravity(Gravity.CENTER_VERTICAL);

    this.setLayoutParams(getCurLayoutParams());
    this.setBackgroundResource(R.drawable.tabletop);
  }
示例#4
0
  public RptTitle(Context context, Panal panal) {
    super(context);
    this.setTextColor(Tool.getTextColor(context));
    this.setText(panal.getCaption());

    this.setTextSize(15);
    this.setPadding(Tool.dip2px(getContext(), 10), 1, Tool.dip2px(getContext(), 15), 1);
    this.setGravity(Gravity.CENTER_VERTICAL);

    this.setLayoutParams(getCurLayoutParams());

    // if (panal.getPanalType() == 1)
    // {
    // this.setLayoutParams(getSurveyLayoutParams());
    // this.setBackgroundResource(R.drawable.tabletop);
    // }
    // else
    // {
    this.setMinHeight(Tool.dip2px(getContext(), 40));
    this.setLayoutParams(getCurLayoutParams());
    this.setBackgroundResource(R.drawable.tabletop);
  }