本文整理汇总了Java中org.chromium.base.ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds方法的典型用法代码示例。如果您正苦于以下问题:Java ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds方法的具体用法?Java ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds怎么用?Java ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.base.ApiCompatibilityUtils
的用法示例。
在下文中一共展示了ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpIcons
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Sets compound drawables (icons) for different kinds of list entries,
* i.e. New Folder, Normal and Selected.
*/
private void setUpIcons(FolderListEntry entry, TextView textView) {
int iconId = 0;
if (entry.mType == FolderListEntry.TYPE_NORMAL) {
iconId = R.drawable.bookmark_folder;
} else if (entry.mType == FolderListEntry.TYPE_NEW_FOLDER) {
// For new folder, start_icon is different.
iconId = R.drawable.bookmark_add_folder;
}
Drawable drawableStart = TintedDrawable.constructTintedDrawable(textView.getResources(),
iconId);
// Selected entry has an end_icon, a blue check mark.
Drawable drawableEnd = entry.mIsSelected ? ApiCompatibilityUtils.getDrawable(
textView.getResources(), R.drawable.ic_check_googblue_24dp) : null;
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(textView,
drawableStart, null, drawableEnd, null);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:BookmarkFolderSelectActivity.java
示例2: configureChildView
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
void configureChildView(int childPosition, ViewHolder viewHolder) {
if (isMoreButton(childPosition)) {
Resources resources = mActivity.getResources();
String text = resources.getString(R.string.recent_tabs_show_more);
viewHolder.textView.setText(text);
Drawable drawable = ApiCompatibilityUtils.getDrawable(
resources, R.drawable.more_horiz);
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
viewHolder.textView, drawable, null, null, null);
} else {
CurrentlyOpenTab openTab = getChild(childPosition);
viewHolder.textView.setText(TextUtils.isEmpty(openTab.getTitle()) ? openTab.getUrl()
: openTab.getTitle());
loadLocalFavicon(viewHolder, openTab.getUrl());
}
}
示例3: setIcon
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
void setIcon(int iconDrawableId) {
if (iconDrawableId == 0) {
setCompoundDrawablePadding(0);
} else {
setCompoundDrawablePadding(getResources().getDimensionPixelSize(
R.dimen.bookmark_drawer_drawable_padding));
}
Drawable drawable = TintedDrawable.constructTintedDrawable(getResources(), iconDrawableId);
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
this, drawable, null, null, null);
}
示例4: initButton
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private ViewGroup initButton(int buttonId, int drawableId) {
ViewGroup button = (ViewGroup) findViewById(buttonId);
TextView textView = (TextView) button.getChildAt(0);
TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResources(), drawableId);
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
textView, icon, null, null, null);
return button;
}
示例5: loadSyncedFavicon
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void loadSyncedFavicon(final ViewHolder viewHolder, final String url) {
Drawable image = mFaviconCache.getSyncedFaviconImage(url);
if (image == null) {
image = faviconDrawable(mRecentTabsManager.getSyncedFaviconImageForURL(url));
image = (image == null) ? mDefaultFavicon : image;
mFaviconCache.putSycnedFaviconImage(url, image);
}
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(viewHolder.textView,
image, null, null, null);
}
示例6: updateSecurityIcon
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void updateSecurityIcon(int securityLevel) {
boolean isSmallDevice = !DeviceFormFactor.isTablet(getContext());
mCurrentIconResource =
LocationBarLayout.getSecurityIconResource(securityLevel, isSmallDevice, false);
if (mCurrentIconResource != 0 && mIconResourceWidths.get(mCurrentIconResource, -1) == -1) {
Drawable icon = ApiCompatibilityUtils.getDrawable(getResources(), mCurrentIconResource);
mIconResourceWidths.put(mCurrentIconResource, icon.getIntrinsicWidth());
}
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(mUrlBar,
mCurrentIconResource, 0, 0, 0);
}