Example usage for android.widget TextView setTag

List of usage examples for android.widget TextView setTag

Introduction

In this page you can find the example usage for android.widget TextView setTag.

Prototype

public void setTag(final Object tag) 

Source Link

Document

Sets the tag associated with this view.

Usage

From source file:info.papdt.blacklight.ui.common.LinearViewPagerIndicator.java

public void addTab(String title) {
    if (mMeasured) {
        throw new IllegalStateException("Cannot add tabs when measured");
    }//from w  w w.  j a  v a  2  s .c om

    TextView tv = new TextView(mContext);
    tv.setText(title);
    tv.setTextColor(mForeground);
    tv.setGravity(Gravity.CENTER);
    tv.setTag(getChildCount());
    tv.setOnClickListener(this);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    params.weight = 1.0f;
    addView(tv, params);
}

From source file:com.jasonchen.microlang.view.LinearViewPagerIndicator.java

public void addTab(String title) {
    if (mMeasured) {
        throw new IllegalStateException("Cannot add tabs when measured");
    }//from   w  w w. j  av  a  2 s . c om

    TextView tv = new TextView(mContext);
    tv.setText(title);
    tv.setTextColor(mForeground);
    tv.setGravity(Gravity.CENTER);
    tv.setTag(getChildCount());
    tv.setOnClickListener(this);
    tv.setBackground(getBackground());
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    params.weight = 1.0f;
    addView(tv, params);
}

From source file:com.jbirdvegas.mgerrit.cards.PatchSetPropertiesCard.java

private void setupUserDetails(final TextView view, final int id, final String email, final String name) {
    view.setTag(id);

    // attach owner's gravatar
    GravatarHelper.attachGravatarToTextView(view, email, mRequestQuery);

    view.setOnClickListener(new View.OnClickListener() {
        @Override// ww w .j ava  2  s .com
        public void onClick(View v) {
            setTrackingUser((Integer) view.getTag());
        }
    });

    setImageCaption(view, R.string.commit_owner, name);
}

From source file:de.domjos.schooltools.activities.MainActivity.java

public static void initTimes(TableLayout grid) {
    Map<Double, Hour> times = new TreeMap<>();
    List<Hour> hours = MainActivity.globals.getSqLite().getHours("");
    for (Hour hour : hours) {
        times.put(Double.parseDouble(hour.getStart().replace(":", ".")), hour);
    }/*from   w  w  w. j  a va2 s.c  om*/

    List hourList = Arrays.asList(times.values().toArray());
    int max = hourList.size() - 1;
    for (int i = 1; i <= grid.getChildCount() - 1; i++) {
        TableRow row = (TableRow) grid.getChildAt(i);
        TextView textView = (TextView) row.getChildAt(0);
        if ((i - 1) <= max) {
            Hour hour = (Hour) hourList.get(i - 1);
            textView.setText(String.format("%s%n%s", hour.getStart(), hour.getEnd()));
            textView.setTag(String.valueOf(hour.getID()));

            if (hour.isBreak()) {
                textView.setTextSize(14);
                textView.setText(textView.getText().toString().replace("\n", ":"));
                for (int j = 1; j <= row.getChildCount() - 1; j++) {
                    row.getChildAt(j).setBackgroundColor(Color.TRANSPARENT);
                    row.setBackgroundResource(R.drawable.tbl_border);
                }
            }
        } else {
            grid.getChildAt(i).setVisibility(View.GONE);
        }
    }
}

From source file:com.zhongsou.souyue.ui.indicator.CheckTabPageIndicator.java

private void addTab(CharSequence text, int index) {
    //      final TabView tabView = new TabView(getContext());
    //      tabView.mIndex = index;
    final TextView tabView = new TextView(getContext());
    tabView.setTag(index);
    if (index == 0) {
        doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_left);
    } else if (index == count - 1) {
        doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_right);
    } else {//w w w  .j a v a  2s .c o  m
        doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_middle);
    }

    tabView.setFocusable(true);
    tabView.setOnClickListener(mTabClickListener);
    tabView.setText(text);

    mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, FILL_PARENT, 1));
}

From source file:ru.orangesoftware.financisto.activity.ActivityLayout.java

public TextView addInfoNode(LinearLayout layout, int id, int labelId, int defaultValueResId) {
    Builder b = inflater.new Builder(layout, R.layout.select_entry_simple);
    View v = b.withId(id, listener).withLabel(labelId).withData(defaultValueResId).create();
    TextView data = v.findViewById(R.id.data);
    data.setTag(v);
    return data;// w w w.  j ava2 s. com
}

From source file:ru.orangesoftware.financisto.activity.ActivityLayout.java

public TextView addInfoNode(LinearLayout layout, int id, String label, String defaultValue) {
    Builder b = inflater.new Builder(layout, R.layout.select_entry_simple);
    View v = b.withId(id, listener).withLabel(label).withData(defaultValue).create();
    TextView data = v.findViewById(R.id.data);
    data.setTag(v);
    return data;//from w w  w  .  j a va 2  s .  c o  m
}

From source file:ru.orangesoftware.financisto.activity.ActivityLayout.java

public TextView addListNode(LinearLayout layout, int id, int labelId, int defaultValueResId) {
    Builder b = inflater.new Builder(layout, R.layout.select_entry);
    View v = b.withId(id, listener).withLabel(labelId).withData(defaultValueResId).create();
    TextView data = v.findViewById(R.id.data);
    data.setTag(v);
    return data;//from   w w  w . ja  va2  s  .co  m
}

From source file:ru.orangesoftware.financisto.activity.ActivityLayout.java

public TextView addInfoNodeSingle(LinearLayout layout, int id, String label) {
    Builder b = inflater.new Builder(layout, R.layout.select_entry_single);
    View v = b.withId(id, listener).withLabel(label).create();
    TextView labelView = v.findViewById(R.id.label);
    labelView.setTag(v);
    return labelView;
}

From source file:ru.orangesoftware.financisto.activity.ActivityLayout.java

public TextView addListNodePlus(LinearLayout layout, int id, int plusId, int labelId, int defaultValueResId) {
    ListBuilder b = inflater.new ListBuilder(layout, R.layout.select_entry_plus);
    View v = b.withButtonId(plusId, listener).withId(id, listener).withLabel(labelId)
            .withData(defaultValueResId).create();

    TextView textView = v.findViewById(R.id.data);
    textView.setTag(v);
    return textView;
}