当前位置: 首页>>代码示例>>Java>>正文


Java TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds方法代码示例

本文整理汇总了Java中android.support.v4.widget.TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds方法的典型用法代码示例。如果您正苦于以下问题:Java TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds方法的具体用法?Java TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds怎么用?Java TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.widget.TextViewCompat的用法示例。


在下文中一共展示了TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addLinkItemView

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
private void addLinkItemView(ViewGroup parent, int resIdText, int resIdDrawable, final String url, String formatArg) {
    TextView view = (TextView) LayoutInflater.from(parent.getContext()).inflate(R.layout.app_details2_link_item, parent, false);
    if (formatArg == null) {
        view.setText(resIdText);
    } else {
        String text = parent.getContext().getString(resIdText, formatArg);
        view.setText(text);
    }
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(view, resIdDrawable, 0, 0, 0);
    parent.addView(view);
    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onLinkClicked(url);
        }
    });
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:18,代码来源:AppDetailsRecyclerViewAdapter.java

示例2: switchMode

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
private void switchMode(boolean isLive) {
    if (mIsLive == isLive) {
        return;
    }
    mIsLive = isLive;

    if (isLive) {
        setContentSeekBarVisibility(GONE);
        setSummaryViewerVisibility(INVISIBLE);

        TextView live = (TextView) View.inflate(mThemeContext, R.layout.live_view, null);
        Drawable drawable = VectorDrawableCompat.create(getResources(), R.drawable.ic_live_player, null);
        TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(live, drawable, null, null, null);
        setCustomViewToColumn(live, CUSTOM_COLUMN_BOTTOM_LEFT);
    } else {
        setContentSeekBarVisibility(VISIBLE);
        setSummaryViewerVisibility(VISIBLE);

        removeViewFromCustomColumn(CUSTOM_COLUMN_BOTTOM_LEFT);
    }
}
 
开发者ID:StraaS,项目名称:StraaS-android-sdk-sample,代码行数:22,代码来源:StraasPlayerView.java

示例3: bindView

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
	ViewHolder holder = (ViewHolder) view.getTag();
	Event event = DatabaseManager.toEvent(cursor, holder.event);
	holder.event = event;

	holder.time.setText(timeDateFormat.format(event.getStartTime()));
	if ((currentTime != -1L) && event.isRunningAtTime(currentTime)) {
		// Contrast colors for running event
		holder.time.setBackgroundColor(timeRunningBackgroundColor);
		holder.time.setTextColor(timeRunningForegroundColor);
	} else {
		// Normal colors
		holder.time.setBackgroundColor(timeBackgroundColor);
		holder.time.setTextColor(timeForegroundColor);
	}

	holder.title.setText(event.getTitle());
	int bookmarkDrawable = DatabaseManager.toBookmarkStatus(cursor) ? R.drawable.ic_bookmark_grey600_24dp : 0;
	TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(holder.title, 0, 0, bookmarkDrawable, 0);
	String personsSummary = event.getPersonsSummary();
	holder.persons.setText(personsSummary);
	holder.persons.setVisibility(TextUtils.isEmpty(personsSummary) ? View.GONE : View.VISIBLE);
	holder.room.setText(event.getRoomName());
}
 
开发者ID:sysdharma,项目名称:py-eventos-android,代码行数:26,代码来源:TrackScheduleListFragment.java

示例4: getView

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	if (convertView == null) {
		convertView = inflater.inflate(R.layout.item_main_menu, parent, false);
		convertView.setOnClickListener(sectionClickListener);
	}

	Section section = getItem(position);
	convertView.setSelected(section == currentSection);

	TextView tv = (TextView) convertView.findViewById(R.id.section_text);
	SpannableString sectionTitle = new SpannableString(getString(section.getTitleResId()));
	Drawable sectionIcon = getResources().getDrawable(section.getIconResId());
	if (section == currentSection) {
		// Special color for the current section
		sectionTitle.setSpan(new ForegroundColorSpan(currentSectionForegroundColor), 0, sectionTitle.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
		// We need to mutate the drawable before applying the ColorFilter, or else all the similar drawable instances will be tinted.
		sectionIcon.mutate().setColorFilter(currentSectionForegroundColor, PorterDuff.Mode.SRC_IN);
	}
	tv.setText(sectionTitle);
	TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(tv, sectionIcon, null, null, null);

	return convertView;
}
 
开发者ID:sysdharma,项目名称:py-eventos-android,代码行数:25,代码来源:MainActivity.java

示例5: bindView

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
	ViewHolder holder = (ViewHolder) view.getTag();
	Event event = DatabaseManager.toEvent(cursor, holder.event);
	holder.event = event;

	holder.title.setText(event.getTitle());
	int bookmarkDrawable = DatabaseManager.toBookmarkStatus(cursor) ? R.drawable.ic_bookmark_grey600_24dp : 0;
	TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(holder.title, 0, 0, bookmarkDrawable, 0);
	String personsSummary = event.getPersonsSummary();
	holder.persons.setText(personsSummary);
	holder.persons.setVisibility(TextUtils.isEmpty(personsSummary) ? View.GONE : View.VISIBLE);
	holder.trackName.setText(event.getTrack().getName());

	Date startTime = event.getStartTime();
	Date endTime = event.getEndTime();
	String startTimeString = (startTime != null) ? timeDateFormat.format(startTime) : "?";
	String endTimeString = (endTime != null) ? timeDateFormat.format(endTime) : "?";
	String details;
	if (showDay) {
		details = String.format("%1$s, %2$s ― %3$s  |  %4$s", event.getDay().getShortName(), startTimeString, endTimeString, event.getRoomName());
	} else {
		details = String.format("%1$s ― %2$s  |  %3$s", startTimeString, endTimeString, event.getRoomName());
	}
	holder.details.setText(details);
}
 
开发者ID:sysdharma,项目名称:py-eventos-android,代码行数:27,代码来源:EventsAdapter.java

示例6: AuthorLayoutViewHolder

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
public AuthorLayoutViewHolder(View itemView) {
    profileRow = (ViewGroup) itemView;
    profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
    authorTextView = (TextView) itemView.findViewById(R.id.discussion_author_text_view);
    dateTextView = (TextView) itemView.findViewById(R.id.discussion_date_text_view);
    answerTextView = (TextView) itemView.findViewById(R.id.discussion_responses_answer_text_view);

    final Context context = answerTextView.getContext();
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
            answerTextView,
            new IconDrawable(context, FontAwesomeIcons.fa_check_square_o)
                    .sizeRes(context, R.dimen.edx_base)
                    .colorRes(context, R.color.edx_success_accent),
            null, null, null);
    RoboGuice.getInjector(context).injectMembers(this);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:17,代码来源:AuthorLayoutViewHolder.java

示例7: createField

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
private static TextView createField(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, @NonNull final FormField field, @NonNull final String value, boolean readOnly, @NonNull View.OnClickListener onClickListener) {
    final TextView textView = (TextView) inflater.inflate(R.layout.edit_user_profile_field, parent, false);
    final SpannableString formattedValue = new SpannableString(value);
    formattedValue.setSpan(new ForegroundColorSpan(parent.getResources().getColor(R.color.edx_brand_gray_base)), 0, formattedValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    textView.setText(ResourceUtil.getFormattedString(parent.getResources(), R.string.edit_user_profile_field, new HashMap<String, CharSequence>() {{
        put("label", field.getLabel());
        put("value", formattedValue);
    }}));
    Context context = parent.getContext();
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
            textView, null, null, new IconDrawable(context, FontAwesomeIcons.fa_angle_right)
                    .colorRes(context, R.color.edx_brand_gray_back)
                    .sizeDp(context, 24), null);
    if (readOnly) {
        textView.setEnabled(false);
        textView.setBackgroundColor(textView.getResources().getColor(R.color.edx_brand_gray_x_back));
    } else {
        textView.setOnClickListener(onClickListener);
    }
    parent.addView(textView);
    return textView;
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:23,代码来源:EditUserProfileFragment.java

示例8: getView

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	if (convertView == null) {
		convertView = inflater.inflate(R.layout.item_main_menu, parent, false);
		convertView.setOnClickListener(sectionClickListener);
	}

	Section section = getItem(position);
	convertView.setSelected(section == currentSection);

	TextView tv = convertView.findViewById(R.id.section_text);
	SpannableString sectionTitle = new SpannableString(getString(section.getTitleResId()));
	Drawable sectionIcon = AppCompatResources.getDrawable(MainActivity.this, section.getIconResId());
	if (section == currentSection) {
		// Special color for the current section
		sectionTitle.setSpan(new ForegroundColorSpan(currentSectionForegroundColor), 0, sectionTitle.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
		// We need to mutate the drawable before applying the ColorFilter, or else all the similar drawable instances will be tinted.
		sectionIcon.mutate().setColorFilter(currentSectionForegroundColor, PorterDuff.Mode.SRC_IN);
	}
	tv.setText(sectionTitle);
	TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(tv, sectionIcon, null, null, null);

	return convertView;
}
 
开发者ID:cbeyls,项目名称:fosdem-companion-android,代码行数:25,代码来源:MainActivity.java

示例9: onBindViewHolder

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, Cursor cursor) {
	Context context = holder.itemView.getContext();
	Event event = DatabaseManager.toEvent(cursor, holder.event);
	holder.event = event;

	holder.title.setText(event.getTitle());
	boolean isBookmarked = DatabaseManager.toBookmarkStatus(cursor);
	Drawable bookmarkDrawable = isBookmarked
			? AppCompatResources.getDrawable(context, R.drawable.ic_bookmark_grey600_24dp)
			: null;
	TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(holder.title, null, null, bookmarkDrawable, null);
	holder.title.setContentDescription(isBookmarked
			? context.getString(R.string.in_bookmarks_content_description, event.getTitle())
			: null
	);
	String personsSummary = event.getPersonsSummary();
	holder.persons.setText(personsSummary);
	holder.persons.setVisibility(TextUtils.isEmpty(personsSummary) ? View.GONE : View.VISIBLE);
	Track track = event.getTrack();
	holder.trackName.setText(track.getName());
	holder.trackName.setTextColor(ContextCompat.getColor(context, track.getType().getColorResId()));
	holder.trackName.setContentDescription(context.getString(R.string.track_content_description, track.getName()));

	bindDetails(holder, event);
}
 
开发者ID:cbeyls,项目名称:fosdem-companion-android,代码行数:27,代码来源:EventsAdapter.java

示例10: setItems

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
public void setItems(final int[] itemsTextsResIds, final int[] itemsIconsResIds) {
    mItemsTextsResIds = itemsTextsResIds;
    mItemsIconsResIds = itemsIconsResIds;
    if (mItemsTextsResIds != null && mSelectedItemPosition >= 0 && mSelectedItemPosition < mItemsTextsResIds.length)
        setText(mItemsTextsResIds[mSelectedItemPosition]);
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(this, null, null, isPopupShown() ? mOpenedDrawable : mClosedDrawable, null);
}
 
开发者ID:AndroidDeveloperLB,项目名称:FullSizePopupSpinner,代码行数:8,代码来源:FullSizePopupSpinner.java

示例11: setSelectedItemPosition

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
public void setSelectedItemPosition(final int selectedItemPosition) {
    int lastSelectedItemPosition = mSelectedItemPosition;
    mSelectedItemPosition = selectedItemPosition;
    final String itemText = mItemsTextsResIds != null && mSelectedItemPosition >= 0 && mSelectedItemPosition < mItemsTextsResIds.length ?
            getResources().getString(mItemsTextsResIds[mSelectedItemPosition]) : null;
    setText(itemText);
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(FullSizePopupSpinner.this, null, null, mClosedDrawable, null);
    if (mOnItemSelectedListener != null)
        mOnItemSelectedListener.onItemSelected(FullSizePopupSpinner.this, selectedItemPosition, itemText, lastSelectedItemPosition);
}
 
开发者ID:AndroidDeveloperLB,项目名称:FullSizePopupSpinner,代码行数:11,代码来源:FullSizePopupSpinner.java

示例12: NoVersionsViewHolder

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
NoVersionsViewHolder(View view) {
    super(view);
    headerView = (TextView) view.findViewById(R.id.information);
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(headerView, R.drawable.ic_access_time_24dp_grey600, 0, 0, 0);

    itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            explainIncompatibleVersions();
        }
    });
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:13,代码来源:AppDetailsRecyclerViewAdapter.java

示例13: setDrawables

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
private void setDrawables() {
  Drawable[] drawables = getDrawables();
  if (passwordVisible) {
    drawables[2] = shownIcon;
  } else {
    drawables[2] = hiddenIcon;
  }
  TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(this,
      drawables[0], drawables[1], tintDrawable(drawables[2]), drawables[3]);
}
 
开发者ID:andrewlord1990,项目名称:materialandroid,代码行数:11,代码来源:PasswordEditText.java

示例14: setCardIcon

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
private void setCardIcon(int icon) {
    if (!mDisplayCardIcon || getText().length() == 0) {
        TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(this, 0, 0, 0, 0);
    } else {
        TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(this, 0, 0, icon, 0);
    }
}
 
开发者ID:braintree,项目名称:android-card-form,代码行数:8,代码来源:CardEditText.java

示例15: NumberResponsesViewHolder

import android.support.v4.widget.TextViewCompat; //导入方法依赖的package包/类
public NumberResponsesViewHolder(View itemView) {
    super(itemView);
    numberResponsesOrCommentsLabel = (TextView) itemView.
            findViewById(R.id.number_responses_or_comments_label);
    Context context = numberResponsesOrCommentsLabel.getContext();
    Drawable iconDrawable = new IconDrawable(context, FontAwesomeIcons.fa_comment)
            .colorRes(context, R.color.edx_brand_gray_base)
            .sizeRes(context, R.dimen.edx_small);
    TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
            numberResponsesOrCommentsLabel, iconDrawable, null, null, null);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:12,代码来源:NumberResponsesViewHolder.java


注:本文中的android.support.v4.widget.TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。