Example usage for android.view View TEXT_ALIGNMENT_TEXT_START

List of usage examples for android.view View TEXT_ALIGNMENT_TEXT_START

Introduction

In this page you can find the example usage for android.view View TEXT_ALIGNMENT_TEXT_START.

Prototype

int TEXT_ALIGNMENT_TEXT_START

To view the source code for android.view View TEXT_ALIGNMENT_TEXT_START.

Click Source Link

Document

Align to the start of the paragraph, e.g.

Usage

From source file:com.example.sam.savemeapp.StatisticsFragment.java

/**
 * Sets up the initial legend with the contained categories shown
 * in the pie chart and bullet points with the corresponding colors.
 *///ww w . j  a v  a2 s  .  c om
public void setUpPiechart() {
    pieChart.getDescription().setEnabled(false);
    Legend pieL = pieChart.getLegend();
    Log.d("stats", Float.toString(pieL.getEntries().length));
    startLegend = pieL;
    LegendEntry[] legends = pieL.getEntries();
    pieL.setEnabled(false);
    mLegend.removeAllViews();
    //The default legend consist of TextViews and ImageViews which contains a bullet point.
    //The legends are contained inside of a horizontal LinearLayout which is contained in a vertical LinearLayout.
    for (int t = 0; t < legends.length - 1; t++) {
        LegendEntry x = legends[t];
        LinearLayout hLayout = new LinearLayout(getContext());
        hLayout.setLayoutParams(params);
        TextView tv = new TextView(getContext());
        tv.setText(x.label);
        tv.setTextColor(x.formColor);
        tv.setTypeface(fontLight);
        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                getResources().getDimension(R.dimen.statistics_main_text_size));
        tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
        LinearLayoutCompat.LayoutParams textViewParams = new LinearLayoutCompat.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        textViewParams.setMarginStart((int) getResources().getDimension(R.dimen.statistics_text_margin));
        tv.setLayoutParams(textViewParams);
        ImageView iv = new ImageView(getContext());
        Drawable dot = ContextCompat.getDrawable(getContext(), R.drawable.circle_legend);
        dot.setColorFilter(x.formColor, PorterDuff.Mode.SRC);
        iv.setImageDrawable(dot);
        iv.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        hLayout.addView(iv);
        hLayout.addView(tv);
        mLegend.addView(hLayout);
    }

    designPiechart();

    pieChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
        private int color;

        @Override
        public void onValueSelected(Entry e, Highlight h) {
            //it creates new legends with the information of the subcategories when a
            // category in the pi chart is clicked
            ArrayList<LegendEntry> list = new ArrayList<>();
            mLegend.removeAllViews();
            if (e.getData().equals(Color.parseColor("#00a0ae"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Food & Beverage")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry("Food & Beverage: "
                        + u.categories.get("Food & Beverage").get("Food & Beverage") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Restaurant & Caf: "
                        + u.categories.get("Food & Beverage").get("Restaurant & Caf") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Supermarket: " + u.categories.get("Food & Beverage").get("Supermarket") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                //This category legends consist of the main category in this case "Food & Beverage" in the top of the legend
                //and the sub categories bellow. The name is also shown together with the amount spend in that category.
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#be3127"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Transportation")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry("Transportation: "
                        + u.categories.get("Transportation").get("Transportation") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Public transport: "
                        + u.categories.get("Transportation").get("Public transport") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Taxi & Uber: " + u.categories.get("Transportation").get("Taxi & Uber") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Petrol: " + u.categories.get("Transportation").get("Petrol") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Maintenance: " + u.categories.get("Transportation").get("Maintenance") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#7dc725"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Shopping")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry(
                        "Shopping: " + u.categories.get("Shopping").get("Shopping") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Clothing: " + u.categories.get("Shopping").get("Clothing") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Electronics: " + u.categories.get("Shopping").get("Electronics") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Books: " + u.categories.get("Shopping").get("Books") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Gifts: " + u.categories.get("Shopping").get("Gifts") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Other: " + u.categories.get("Shopping").get("Other") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#e88300"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Entertainment")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry(
                        "Entertainment: " + u.categories.get("Entertainment").get("Entertainment") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Going out: " + u.categories.get("Entertainment").get("Going out") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Sports: " + u.categories.get("Entertainment").get("Sports") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#dc006d"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Health")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry("Health: " + u.categories.get("Health").get("Health") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Doctor: " + u.categories.get("Health").get("Doctor") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Pharmacy: " + u.categories.get("Health").get("Pharmacy") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#1562a4"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Bills")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry("Bills: " + u.categories.get("Bills").get("Bills") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Water: " + u.categories.get("Bills").get("Water") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Electricity: " + u.categories.get("Bills").get("Electricity") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Gas: " + u.categories.get("Bills").get("Gas") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Rent: " + u.categories.get("Bills").get("Rent") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Phone: " + u.categories.get("Bills").get("Phone") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(
                        new LegendEntry("Insurance: " + u.categories.get("Bills").get("Insurance") + u.currency,
                                Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("TV: " + u.categories.get("Bills").get("TV") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Internet: " + u.categories.get("Bills").get("Internet") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            }
        }

        @Override
        public void onNothingSelected() {
            //Sets up the default legend when nothing is selected
            pieChart = (PieChart) v.findViewById(R.id.piechart);
            pieChart.setUsePercentValues(true);
            LegendEntry[] legends = startLegend.getEntries();
            startLegend.setEnabled(false);
            mLegend.removeAllViews();
            for (LegendEntry x : legends) {
                LinearLayout hLayout = new LinearLayout(getContext());
                hLayout.setLayoutParams(params);
                TextView tv = new TextView(getContext());
                tv.setText(x.label);
                tv.setTextColor(x.formColor);
                tv.setTypeface(fontLight);
                tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                        getResources().getDimension(R.dimen.statistics_main_text_size));
                tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                LinearLayoutCompat.LayoutParams textViewParams = new LinearLayoutCompat.LayoutParams(
                        ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                textViewParams
                        .setMarginStart((int) getResources().getDimension(R.dimen.statistics_text_margin));
                tv.setLayoutParams(textViewParams);
                ImageView iv = new ImageView(getContext());
                Drawable dot = ContextCompat.getDrawable(getContext(), R.drawable.circle_legend);
                dot.setColorFilter(x.formColor, PorterDuff.Mode.SRC);
                iv.setImageDrawable(dot);
                iv.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                        ViewGroup.LayoutParams.MATCH_PARENT));
                hLayout.addView(iv);
                hLayout.addView(tv);
                mLegend.addView(hLayout);
            }
        }
    });
}

From source file:com.facebook.litho.widget.TextSpec.java

private static Alignment getAlignment(int viewTextAlignment, int gravity) {
    final Alignment alignment;
    switch (viewTextAlignment) {
    case View.TEXT_ALIGNMENT_GRAVITY:
        alignment = getAlignment(gravity);
        break;/*from  w w w  .  ja v  a2  s.  c  o  m*/
    case View.TEXT_ALIGNMENT_TEXT_START:
        alignment = ALIGN_NORMAL;
        break;
    case View.TEXT_ALIGNMENT_TEXT_END:
        alignment = ALIGN_OPPOSITE;
        break;
    case View.TEXT_ALIGNMENT_CENTER:
        alignment = ALIGN_CENTER;
        break;
    case View.TEXT_ALIGNMENT_VIEW_START: // unsupported, default to normal
        alignment = ALIGN_NORMAL;
        break;
    case View.TEXT_ALIGNMENT_VIEW_END: // unsupported, default to opposite
        alignment = ALIGN_OPPOSITE;
        break;
    case View.TEXT_ALIGNMENT_INHERIT: // unsupported, default to gravity
        alignment = getAlignment(gravity);
        break;
    default:
        alignment = textAlignment;
        break;
    }
    return alignment;
}

From source file:com.nickandjerry.dynamiclayoutinflator.DynamicLayoutInflator.java

public static void createViewRunnables() {
    viewRunnables = new HashMap<>(30);
    viewRunnables.put("scaleType", new ViewParamRunnable() {
        @Override//w w w.j av  a2  s  .c  o  m
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof ImageView) {
                ImageView.ScaleType scaleType = ((ImageView) view).getScaleType();
                switch (value.toLowerCase()) {
                case "center":
                    scaleType = ImageView.ScaleType.CENTER;
                    break;
                case "center_crop":
                    scaleType = ImageView.ScaleType.CENTER_CROP;
                    break;
                case "center_inside":
                    scaleType = ImageView.ScaleType.CENTER_INSIDE;
                    break;
                case "fit_center":
                    scaleType = ImageView.ScaleType.FIT_CENTER;
                    break;
                case "fit_end":
                    scaleType = ImageView.ScaleType.FIT_END;
                    break;
                case "fit_start":
                    scaleType = ImageView.ScaleType.FIT_START;
                    break;
                case "fit_xy":
                    scaleType = ImageView.ScaleType.FIT_XY;
                    break;
                case "matrix":
                    scaleType = ImageView.ScaleType.MATRIX;
                    break;
                }
                ((ImageView) view).setScaleType(scaleType);
            }
        }
    });
    viewRunnables.put("orientation", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof LinearLayout) {
                ((LinearLayout) view).setOrientation(
                        value.equals("vertical") ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL);
            }
        }
    });
    viewRunnables.put("text", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof TextView) {
                ((TextView) view).setText(value);
            }
        }
    });
    viewRunnables.put("textSize", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof TextView) {
                ((TextView) view).setTextSize(TypedValue.COMPLEX_UNIT_PX,
                        DimensionConverter.stringToDimension(value, view.getResources().getDisplayMetrics()));
            }
        }
    });
    viewRunnables.put("textColor", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof TextView) {
                ((TextView) view).setTextColor(parseColor(view, value));
            }
        }
    });
    viewRunnables.put("textStyle", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof TextView) {
                int typeFace = Typeface.NORMAL;
                if (value.contains("bold"))
                    typeFace |= Typeface.BOLD;
                else if (value.contains("italic"))
                    typeFace |= Typeface.ITALIC;
                ((TextView) view).setTypeface(null, typeFace);
            }
        }
    });
    viewRunnables.put("textAlignment", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
                int alignment = View.TEXT_ALIGNMENT_TEXT_START;
                switch (value) {
                case "center":
                    alignment = View.TEXT_ALIGNMENT_CENTER;
                    break;
                case "left":
                case "textStart":
                    break;
                case "right":
                case "textEnd":
                    alignment = View.TEXT_ALIGNMENT_TEXT_END;
                    break;
                }
                view.setTextAlignment(alignment);
            } else {
                int gravity = Gravity.LEFT;
                switch (value) {
                case "center":
                    gravity = Gravity.CENTER;
                    break;
                case "left":
                case "textStart":
                    break;
                case "right":
                case "textEnd":
                    gravity = Gravity.RIGHT;
                    break;
                }
                ((TextView) view).setGravity(gravity);
            }
        }
    });
    viewRunnables.put("ellipsize", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof TextView) {
                TextUtils.TruncateAt where = TextUtils.TruncateAt.END;
                switch (value) {
                case "start":
                    where = TextUtils.TruncateAt.START;
                    break;
                case "middle":
                    where = TextUtils.TruncateAt.MIDDLE;
                    break;
                case "marquee":
                    where = TextUtils.TruncateAt.MARQUEE;
                    break;
                case "end":
                    break;
                }
                ((TextView) view).setEllipsize(where);
            }
        }
    });
    viewRunnables.put("singleLine", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof TextView) {
                ((TextView) view).setSingleLine();
            }
        }
    });
    viewRunnables.put("hint", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof EditText) {
                ((EditText) view).setHint(value);
            }
        }
    });
    viewRunnables.put("inputType", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof TextView) {
                int inputType = 0;
                switch (value) {
                case "textEmailAddress":
                    inputType |= InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
                    break;
                case "number":
                    inputType |= InputType.TYPE_CLASS_NUMBER;
                    break;
                case "phone":
                    inputType |= InputType.TYPE_CLASS_PHONE;
                    break;
                }
                if (inputType > 0)
                    ((TextView) view).setInputType(inputType);
            }
        }
    });
    viewRunnables.put("gravity", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            int gravity = parseGravity(value);
            if (view instanceof TextView) {
                ((TextView) view).setGravity(gravity);
            } else if (view instanceof LinearLayout) {
                ((LinearLayout) view).setGravity(gravity);
            } else if (view instanceof RelativeLayout) {
                ((RelativeLayout) view).setGravity(gravity);
            }
        }
    });
    viewRunnables.put("src", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            if (view instanceof ImageView) {
                String imageName = value;
                if (imageName.startsWith("//"))
                    imageName = "http:" + imageName;
                if (imageName.startsWith("http")) {
                    if (imageLoader != null) {
                        if (attrs.containsKey("cornerRadius")) {
                            int radius = DimensionConverter.stringToDimensionPixelSize(
                                    attrs.get("cornerRadius"), view.getResources().getDisplayMetrics());
                            imageLoader.loadRoundedImage((ImageView) view, imageName, radius);
                        } else {
                            imageLoader.loadImage((ImageView) view, imageName);
                        }
                    }
                } else if (imageName.startsWith("@drawable/")) {
                    imageName = imageName.substring("@drawable/".length());
                    ((ImageView) view).setImageDrawable(getDrawableByName(view, imageName));
                }
            }
        }
    });
    viewRunnables.put("visibility", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            int visibility = View.VISIBLE;
            String visValue = value.toLowerCase();
            if (visValue.equals("gone"))
                visibility = View.GONE;
            else if (visValue.equals("invisible"))
                visibility = View.INVISIBLE;
            view.setVisibility(visibility);
        }
    });
    viewRunnables.put("clickable", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            view.setClickable(value.equals("true"));
        }
    });
    viewRunnables.put("tag", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            // Sigh, this is dangerous because we use tags for other purposes
            if (view.getTag() == null)
                view.setTag(value);
        }
    });
    viewRunnables.put("onClick", new ViewParamRunnable() {
        @Override
        public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
            view.setOnClickListener(getClickListener(parent, value));
        }
    });
}