當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.setTag方法代碼示例

本文整理匯總了Java中android.widget.TextView.setTag方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setTag方法的具體用法?Java TextView.setTag怎麽用?Java TextView.setTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setTag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUpReturnOrderView

import android.widget.TextView; //導入方法依賴的package包/類
private void setUpReturnOrderView(ReturnOrderDetailResponse returnOrderDetailResponse) {
        TextView tv = new TextView(getActivityContext());
        tv.setTextSize(14);
        tv.setTextColor(Color.parseColor(getString(R.string.textColorThird)));
        tv.setGravity(Gravity.CENTER_VERTICAL);
        tv.setTag(returnOrderDetailResponse.getReturnOrder().getReturnOrderID());
        if (!TextUtils.isEmpty(returnOrderDetailResponse.getReturnOrder().getName())) {
            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                    CommonUtils.dip2px(getActivityContext(), 40));
            SpannableString ss = new SpannableString(getString(R.string.tag_return_order_num) + returnOrderDetailResponse.getReturnOrder().getName());
            ss.setSpan(new ForegroundColorSpan(Color.parseColor(getString(R.string.color_return_order_num))), 5, 5 + returnOrderDetailResponse.getReturnOrder().getName().length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
            tv.setText(ss);
            mLlReturn.addView(tv, params);
            tv.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //跳轉到退貨單詳情
//                    Intent intent = new Intent(mContext, ReturnDetailActivity.class);
//                    intent.putExtra("rid", returnId);
//                    startActivity(intent);
                }
            });
        }
    }
 
開發者ID:ebridfighter,項目名稱:GongXianSheng,代碼行數:25,代碼來源:OrderDetailActivity.java

示例2: addTextView

import android.widget.TextView; //導入方法依賴的package包/類
private void addTextView(Context context, int viewTag) {
    TextView tv = (TextView) View.inflate(context, R.layout.custom_textview, null);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.weight = 1.0F;

    tv.setLayoutParams(layoutParams);
    tv.setOnClickListener(this);
    tv.setGravity(Gravity.CENTER);
    if (mTextSize > 0f)
        tv.setTextSize(0, mTextSize);

    tv.setOnClickListener(this);
    tv.setTag(viewTag);
    if (viewTag == TAG_LEFT_VIEW) {
        tv.setText(mLeftText);
        mLeftTextView = tv;
    } else if (viewTag == TAG_NONE_VIEW) {
        tv.setText(mSimpleText);
        mSimpleTextView = tv;
    } else if (viewTag == TAG_RIGHT_VIEW) {
        tv.setText(mRightText);
        mRightTextView = tv;
    }
    addView(tv);
}
 
開發者ID:guzhigang001,項目名稱:Bailan,代碼行數:26,代碼來源:SubTabNavigator.java

示例3: addHintIcon

import android.widget.TextView; //導入方法依賴的package包/類
public void addHintIcon(int drawableId)
{
	if (this.mHintIconArray.indexOfKey(drawableId) == -1)
	{
		this.mHintIconArray.put(drawableId, drawableId);
		
		TextView tv = new TextView(mContext);
		tv.setTag(drawableId);
		tv.setGravity(Gravity.CENTER);
		ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
				ViewGroup.LayoutParams.WRAP_CONTENT);
		tv.setLayoutParams(lp);
		tv.setBackgroundResource(drawableId);
		tv.setIncludeFontPadding(false);
		
		this.mHintIcons.addView(tv);
	}
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:19,代碼來源:XPreferenceGreen.java

示例4: getView

import android.widget.TextView; //導入方法依賴的package包/類
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
    TrackMetaData trackMetaData= getItem(position);
    if (convertView==null){
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.displaysongs,parent,false);
    }
    final TextView TrackTitle = (TextView) convertView.findViewById(R.id.song_title);
    final TextView TrackAuthor = (TextView) convertView.findViewById(R.id.song_author);
    TrackTitle.setOnClickListener(onClickListener);
    TrackTitle.setTag(R.string.TitleTag,position);
    if (trackMetaData.getISsongSelected()){
        TrackTitle.setTextColor(getResources().getColor(R.color.colorTrackPlay));
        Intent intent = new Intent(getContext(),TrackInfoActivity.class);
        Bundle b = new Bundle();
        b.putParcelable(TrackINFO,trackMetaData);
        intent.putExtras(b);
        startActivity(intent);
    }
    else{
        TrackTitle.setTextColor(getResources().getColor(R.color.colorTrackDefault));
    }
    TrackTitle.setText(trackMetaData.getTrackTitle());
    TrackAuthor.setText(trackMetaData.getTrackArtist());
    return convertView;
}
 
開發者ID:suhaas-livcd,項目名稱:Android_Labs,代碼行數:27,代碼來源:ListActivity.java

示例5: getThreed

import android.widget.TextView; //導入方法依賴的package包/類
private static Threed getThreed(TextView view) {
    if (view == null) {
        throw new IllegalArgumentException("view must be non-null");
    }
    Object tag = view.getTag(R.id.threed);
    if (tag instanceof Threed) {
        return (Threed) tag;
    }
    Threed t = new Threed();
    t.textView = view;
    view.setTag(R.id.threed, t);
    return t;
}
 
開發者ID:samelody,項目名稱:threed,代碼行數:14,代碼來源:Threed.java

示例6: makeColorPresetButton

import android.widget.TextView; //導入方法依賴的package包/類
private void makeColorPresetButton(int color) {
        FrameLayout outframe = new FrameLayout(getContext());
        outframe.setBackgroundColor(Color.BLACK);
        outframe.setPadding(6,6,6,6);

        FrameLayout frame = new FrameLayout(getContext());
        //frame.setBackgroundColor(Color.BLACK);
        frame.setBackgroundResource(R.drawable.transparentgrid);

        TextView c = new TextView(getContext());
        c.setText("   ");
        c.setTextSize(22);
        c.setBackgroundColor(color);
//        if (color==Color.TRANSPARENT) {
//            c.setBackgroundResource(R.drawable.transparentgrid);
//        }
        c.setTag(color);
        c.setClickable(true);
        c.setOnClickListener(setColorListener);
        frame.addView(c);
        GridLayout.LayoutParams lp = new GridLayout.LayoutParams();
        lp.setMargins(24, 16, 24, 16);
        outframe.setPadding(6,6,6,6);
        outframe.addView(frame);
        colorPresets.addView(outframe, lp);
    }
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:27,代碼來源:ColorChooser.java

示例7: getView

import android.widget.TextView; //導入方法依賴的package包/類
@Override public View getView(int position, View convertView, ViewGroup parent) {
    TextView view = (TextView) super.getView(position, convertView, parent);
    view.setTextColor(Color.DKGRAY);
    view.setTag("" + position);
    Item item = getItem(position);
    if (item.type == Item.SECTION) {
        //view.setOnClickListener(PinnedSectionListActivity.this);
        view.setBackgroundColor(parent.getResources().getColor(COLORS[item.sectionPosition % COLORS.length]));
    }
    return view;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:PinnedSectionListActivity.java

示例8: init

import android.widget.TextView; //導入方法依賴的package包/類
private void init(Context context) {
    setOrientation(LinearLayout.HORIZONTAL);
    int paddingTopBottom = ConvertUtils.toPx(context, ITEM_PADDING_TOP_BOTTOM);
    int paddingLeftRight = ConvertUtils.toPx(context, ITEM_PADDING_LEFT_RIGHT);
    setPadding(paddingLeftRight, paddingTopBottom, paddingLeftRight, paddingTopBottom);
    setGravity(Gravity.CENTER);
    int height = ConvertUtils.toPx(context, ITEM_HEIGHT);
    // fixed: 17-1-8 #79 安卓4.x兼容問題,java.lang.ClassCastException……onMeasure……
    setLayoutParams(new AbsListView.LayoutParams(MATCH_PARENT, height));

    imageView = new ImageView(getContext());
    imageView.setTag(ITEM_TAG_IMAGE);
    imageView.setVisibility(View.GONE);
    LayoutParams imageParams = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    imageParams.rightMargin = ConvertUtils.toPx(context, ITEM_MARGIN);
    addView(imageView, imageParams);

    textView = new TextView(getContext());
    textView.setTag(ITEM_TAG_TEXT);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setSingleLine(true);
    textView.setIncludeFontPadding(false);
    textView.setGravity(Gravity.CENTER);
    textView.setTextColor(Color.BLACK);
    LayoutParams textParams = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    addView(textView, textParams);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:28,代碼來源:WheelListView.java

示例9: handleLinksWithShowMore

import android.widget.TextView; //導入方法依賴的package包/類
private static void handleLinksWithShowMore(TextView view, Post post) {
    String showMore = " [詳細] ";
    String content = post.body + showMore;
    SpannableString spannable = convertNormalStringToSpannableString(content);
    spannable.setSpan(new RelativeSizeSpan(0.8f), content.length() - showMore.length(),
            content.length(), 17);
    spannable.setSpan(new ShowMoreSpan("showMore"), content.length() - showMore.length(),
            content.length(), 17);
    view.setText(spannable);
    view.setTag(R.id.timeline_post_id, Integer.valueOf(post.id));
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:12,代碼來源:TimeLineUtility.java

示例10: setCountText

import android.widget.TextView; //導入方法依賴的package包/類
public static ObjectAnimator setCountText(TextView view, int count, boolean animate) {
    if (Objects.nonNull(view)) {
        if (animate) {
            ObjectAnimator animator = ObjectAnimator.ofInt(view, createAmountAnimatorProperty(DEFAULT_COUNT_FORMATTER), count);
            animator.setDuration(250);
            animator.start();
            return animator;
        } else {
            view.setTag(count);
            view.setText(DEFAULT_COUNT_FORMATTER.format(count));
        }
    }

    return null;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:16,代碼來源:ViewUtils.java

示例11: getLoadingView

import android.widget.TextView; //導入方法依賴的package包/類
private View getLoadingView() {
    TextView tv = new TextView(this);
    tv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    tv.setText("Helper中定義的加載中");
    tv.setGravity(Gravity.CENTER);
    tv.setTextSize(18);
    tv.setTextColor(Color.RED);
    // 設置tag為loading
    tv.setTag(StatusLayout.Status.LOADING.getStatus());
    return tv;
}
 
開發者ID:yhyzgn,項目名稱:Widgets,代碼行數:12,代碼來源:HelperActivity.java

示例12: instantiateItem

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    Log.i(TAG, "instantiateItem>>>" + position);
    View child = chilren.get(position);
    if (child == null) {
        child = inflater.inflate(R.layout.target_poi_item_detail, null);
        chilren.put(position, child);
    }
    child.findViewById(R.id.tpid_target_confirm_bt).setOnClickListener(clickListener);
    child.findViewById(R.id.tpid_target_confirm_bt).setTag(position);
    ((TextView) child.findViewById(R.id.tpid_name_text)).setText((position + 1) + "." + aList.get(position).getName());
    ((TextView) child.findViewById(R.id.tpid_address_text)).setText(aList.get(position).getAddress());
    Double distance = DistanceUtil.getDistance(new LatLng(address.getLatitude(), address.getLongitude()),
            poiInfoList.get(position).location) / 1000;
    ((TextView) child.findViewById(R.id.tpid_distance_text)).setText(String.format("%.1f", distance) + "km");
    child.findViewById(R.id.tpid_set_target_bt).setOnClickListener(clickListener);
    child.findViewById(R.id.tpid_set_target_bt).setTag(position);
    TextView ft = (TextView) child.findViewById(R.id.tpid_favorite_bt);
    ft.setOnClickListener(clickListener);
    ft.setTag(position);
    if (aList.get(position).getFavoritedTime() != null) {
        ft.setText("已收藏");
        ((LevelListDrawable) ft.getBackground()).setLevel(1);
    }
    container.addView(child, 0);
    return chilren.get(position);
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:28,代碼來源:TrafficShowPresenter.java

示例13: addTask

import android.widget.TextView; //導入方法依賴的package包/類
public void addTask(View view) {
    //模擬路徑
    String path = "/sdcard/imgs/" + (++i) + ".png";
    MyIntentService.startUploadImg(this, path);

    TextView tv = new TextView(this);
    mLyTaskContainer.addView(tv);
    tv.setText(path + " is uploading ...");
    tv.setTag(path);
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:11,代碼來源:IntentServiceActivity.java

示例14: getItemView

import android.widget.TextView; //導入方法依賴的package包/類
private View getItemView(int position){
    TextView textView = new TextView(mContext);
    textView.setTextAppearance(mContext, R.style.switcher_item_text_style);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            DensityUtil.dip2px(mContext,40));
    textView.setLayoutParams(layoutParams);
    textView.setSelected(position == mDefaultSelection);
    textView.setGravity(Gravity.CENTER);
    textView.setText(mAllItemArray.get(position));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12.0f);
    textView.setOnClickListener(mItemOnClickListener);
    textView.setTag(position);
    return textView;
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:15,代碼來源:EasySwitcher.java

示例15: DrawableGetter

import android.widget.TextView; //導入方法依賴的package包/類
public DrawableGetter(TextView tv, int width) {
    tv.setTag(R.id.drawable_callback, this);
    this.container = new WeakReference<>(tv);
    this.cachedTargets = new HashSet<>();
    this.width = width;
}
 
開發者ID:duyp,項目名稱:mvvm-template,代碼行數:7,代碼來源:DrawableGetter.java


注:本文中的android.widget.TextView.setTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。