本文整理汇总了Java中android.support.v7.widget.AppCompatImageView类的典型用法代码示例。如果您正苦于以下问题:Java AppCompatImageView类的具体用法?Java AppCompatImageView怎么用?Java AppCompatImageView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppCompatImageView类属于android.support.v7.widget包,在下文中一共展示了AppCompatImageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showInfo
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
protected void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) {
hideKeyboard();
AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header);
AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc);
AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img);
if (error) {
llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE);
((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close");
} else {
llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE);
((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok");
}
infoHeader.setText(header);
infoDesc.setText(desc);
if (drawable != null)
infoImg.setImageDrawable(drawable);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
示例2: getView
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
FolderViewHolder holder = null;
if (convertView == null) {
convertView = View.inflate(mContext, R.layout.item_listview_dir, null);
holder = new FolderViewHolder();
holder.id_dir_item_image = (AppCompatImageView) convertView.findViewById(R.id.id_dir_item_image);
holder.id_dir_item_name = (AppCompatTextView) convertView.findViewById(R.id.id_dir_item_name);
holder.id_dir_item_count = (AppCompatTextView) convertView.findViewById(R.id.id_dir_item_count);
holder.choose = (AppCompatImageView) convertView.findViewById(R.id.choose);
convertView.setTag(holder);
} else {
holder = (FolderViewHolder) convertView.getTag();
}
ImageFolder item = mDirPaths.get(position);
mImageLoader.displayImage("file://" + item.getFirstImagePath(), holder.id_dir_item_image, options);
holder.id_dir_item_count.setText(item.images.size() + "张");
holder.id_dir_item_name.setText(item.getName());
holder.choose.setVisibility(currentImageFolder == item ? View.VISIBLE : View.GONE);
return convertView;
}
示例3: getView
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
StatisticsActivity.Achievement achievement = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext())
.inflate(R.layout.achievement_list_template, parent, false);
}
AppCompatTextView title = (AppCompatTextView)convertView.findViewById(R.id.achievement_list_item_title);
AppCompatTextView description = (AppCompatTextView)convertView.findViewById(R.id.achievement_list_item_description);
AppCompatImageView layer1 = (AppCompatImageView)convertView.findViewById(R.id.medal_layer1);
AppCompatImageView layer2 = (AppCompatImageView)convertView.findViewById(R.id.medal_layer2);
AppCompatImageView layer3 = (AppCompatImageView)convertView.findViewById(R.id.medal_layer3);
if(achievement != null) {
if(achievement.title != null) title.setText(achievement.title);
if(achievement.description != null) description.setText(achievement.description);
layer1.setColorFilter(achievement.getBandColor(), PorterDuff.Mode.SRC_IN);
layer2.setColorFilter(achievement.getMedalBrightColor(), PorterDuff.Mode.SRC_IN);
layer3.setColorFilter(achievement.getMedalDarkColor(), PorterDuff.Mode.SRC_IN);
}
return convertView;
}
示例4: getView
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
final RuuviTag tag = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_item_add, parent, false);
}
((TextView)convertView.findViewById(R.id.address)).setText(tag.id);
((TextView)convertView.findViewById(R.id.rssi)).setText(String.format(getContext().getResources().getString(R.string.signal_reading), tag.rssi));
AppCompatImageView signalIcon = convertView.findViewById(R.id.signalIcon);
if (tag.rssi < -80) signalIcon.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.icon_connection_1));
else if (tag.rssi < -50) signalIcon.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.icon_connection_2));
else signalIcon.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.icon_connection_3));
return convertView;
}
示例5: setupUserAvatar
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
private void setupUserAvatar(AppCompatImageView avatar, Me.ProfileImage image) {
int flag = CalendarUtils.festivalFlag();
if (2 == flag) {
avatar.setImageResource(R.mipmap.new_year_round);
} else if (1 == flag) {
avatar.setImageResource(R.mipmap.new_year_dog2);
} else {
if (null == image) {
avatar.setImageResource(R.mipmap.bg_dark_avatar_male_big_normal);
} else {
RequestBuilder<Bitmap> bitmapRequestBuilder = GlideApp.with(getActivity())
.asBitmap()
.load(image.large)
.error(R.mipmap.bg_dark_avatar_male_big_normal)
.placeholder(R.mipmap.bg_dark_avatar_male_big_normal)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.fallback(R.mipmap.bg_dark_avatar_male_big_normal);
bitmapRequestBuilder.into(avatar);
}
}
}
示例6: onCreate
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LocaleUtils.loadLocale(this);
setContentView(R.layout.activity_splash);
AppCompatImageView logo = findViewById(R.id.logo);
logo.setVisibility(View.VISIBLE);
// final SpringyAnimator scaleY = new SpringyAnimator(SpringAnimationType.SCALEY, 5, 3, 0.5f, 1);
// final SpringyAnimator rotate = new SpringyAnimator(SpringAnimationType.ROTATEY, 5, 3, 180, 0);
// rotate.setDelay(100);
// scaleY.setDelay(200);
// rotate.startSpring(logo);
// scaleY.startSpring(logo);
new Timer().schedule(new TimerTask() {
@Override
public void run() {
startActivity(new Intent(SplashActivity.this, MainActivity.class));
finishAfterTransition();
}
}, 800);
}
示例7: convert
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@Override
protected void convert(BaseViewHolder holder, final Collection item) {
final CardView layout = holder.getView(R.id.item_layout);
final AppCompatTextView title = holder.getView(R.id.title_txt);
final AppCompatTextView count = holder.getView(R.id.count_txt);
title.setText(String.valueOf(item.title));
count.setText(count.getContext().getString(R.string.photos, String.valueOf(item.total_photos)));
final AppCompatImageView image = holder.getView(R.id.item_image);
Collection.CoverPhoto cp = item.cover_photo;
mFullRequest.load(getRegularSizeUrl(cp.urls.regular))
.thumbnail(mThumbRequest.load(cp.urls.thumb))
.into(image);
float finalHeight = displaymetrics.widthPixels / ((float) cp.width / (float) cp.height);
image.setMinimumHeight((int) finalHeight);
startSaturationAnimation(image.getContext(), image);
layout.setCardBackgroundColor(computeCardBackgroundColor(cp.color));
}
示例8: startSaturationAnimation
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
private void startSaturationAnimation(Context context, final AppCompatImageView target) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
target.setHasTransientState(true);
final AnimUtils.ObservableColorMatrix matrix = new AnimUtils.ObservableColorMatrix();
final ObjectAnimator saturation = ObjectAnimator.ofFloat(
matrix, AnimUtils.ObservableColorMatrix.SATURATION, 0f, 1f);
saturation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
target.setColorFilter(new ColorMatrixColorFilter(matrix));
}
});
saturation.setDuration(2000);
saturation.setInterpolator(AnimUtils.getFastOutSlowInInterpolator(context));
saturation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
target.clearColorFilter();
target.setHasTransientState(false);
}
});
saturation.start();
}
}
示例9: showThumbnail
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@Override
public View showThumbnail(BigImageView parent, Uri thumbnail, int scaleType) {
AppCompatImageView thumbnailView = (AppCompatImageView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.ui_glide_thumbnail, parent, false);
switch (scaleType) {
case BigImageView.INIT_SCALE_TYPE_CENTER_CROP:
thumbnailView.setScaleType(ImageView.ScaleType.CENTER_CROP);
break;
case BigImageView.INIT_SCALE_TYPE_CENTER_INSIDE:
thumbnailView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
break;
case BigImageView.INIT_SCALE_TYPE_START:
thumbnailView.setScaleType(ImageView.ScaleType.FIT_START);
break;
default:
break;
}
mRequestManager
.load(thumbnail)
.into(thumbnailView);
return thumbnailView;
}
示例10: onCreateView
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@Override
public void onCreateView(View view) {
mTitle = (TextView) view.findViewById(R.id.title);
mSummary = (TextView) view.findViewById(R.id.summary);
mArrow = (AppCompatImageView) view.findViewById(R.id.arrow_image);
mParent = (LinearLayout) view.findViewById(R.id.parent_layout);
mItemHeight = view.getResources().getDimension(R.dimen.rv_drop_down_item_height);
mArrow.setRotationX(mExpanded ? 0 : 180);
setHeight(mExpanded && mItems != null ? Math.round(mItemHeight * mItems.size()) : 0);
view.findViewById(R.id.title_parent).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mExpanded) {
collapse();
} else {
expand();
}
}
});
super.onCreateView(view);
}
示例11: onCreate
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
prefManager = new PrefManager(this);
AppCompatImageView en = (AppCompatImageView)findViewById(R.id.langEn);
AppCompatImageView mn = (AppCompatImageView)findViewById(R.id.langMn);
AppCompatImageView cn = (AppCompatImageView)findViewById(R.id.langCn);
AppCompatImageView ru = (AppCompatImageView)findViewById(R.id.langRu);
mn.setOnClickListener(this);
en.setOnClickListener(this);
cn.setOnClickListener(this);
ru.setOnClickListener(this);
}
示例12: centerMenuIcon
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
private void centerMenuIcon() {
BottomNavigationMenuView menuView = getBottomMenuView();
if (menuView != null) {
for (int i = 0; i < menuView.getChildCount(); i++) {
BottomNavigationItemView menuItemView = (BottomNavigationItemView) menuView.getChildAt(i);
AppCompatImageView icon = (AppCompatImageView) menuItemView.getChildAt(0);
FrameLayout.LayoutParams params = (LayoutParams) icon.getLayoutParams();
params.gravity = Gravity.CENTER;
menuItemView.setShiftingMode(true);
}
}
}
示例13: initActivity
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
@Override
protected void initActivity(@Nullable Bundle savedInstanceState) {
presenter = new MainPresenter(this);
homeBanner = (ImageView) findViewById(iv_home_banner);
tabLayout = (TabLayout) findViewById(R.id.tab_home_category);
appBarLayout = (AppBarLayout) findViewById(R.id.appbar);
viewPager = (ViewPager) findViewById(R.id.vp_home_category);
floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_home_random);
coordinatorLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
setting = (AppCompatImageView) findViewById(R.id.iv_home_setting);
setFabDynamicState();
homeBanner.setOnClickListener(this);
floatingActionButton.setOnClickListener(this);
setting.setOnClickListener(this);
presenter.getServerData();
viewPager.setAdapter(new MainPagerAdapter(getSupportFragmentManager()));
tabLayout.setupWithViewPager(viewPager);
}
示例14: showInfo
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
private void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) {
hideKeyboard();
AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header);
AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc);
AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img);
if (error) {
llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE);
((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close");
} else {
llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE);
((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok");
}
infoHeader.setText(header);
infoDesc.setText(desc);
if (drawable != null)
infoImg.setImageDrawable(drawable);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
示例15: setOverflowButtonColor
import android.support.v7.widget.AppCompatImageView; //导入依赖的package包/类
/**
* It's important to set overflowDescription atribute in styles, so we can grab the reference
* to the overflow icon. Check: res/values/styles.xml
*
* @param activity
* @param colorFilter
*/
private static void setOverflowButtonColor(final Activity activity, final PorterDuffColorFilter colorFilter) {
final String overflowDescription = activity.getString(R.string.abc_action_menu_overflow_description);
final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver();
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
final ArrayList<View> outViews = new ArrayList<View>();
decorView.findViewsWithText(outViews, overflowDescription,
View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
if (outViews.isEmpty()) {
return;
}
AppCompatImageView overflow = (AppCompatImageView) outViews.get(0);
overflow.setColorFilter(colorFilter);
removeOnGlobalLayoutListener(decorView, this);
}
});
}