本文整理汇总了Java中android.widget.ImageView.setAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setAlpha方法的具体用法?Java ImageView.setAlpha怎么用?Java ImageView.setAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.setAlpha方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transformPage
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
ImageView imgView = (ImageView)view.findViewById(R.id.img);
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
} else if (position <= 0) { // [-1,0]
view.setAlpha((1 - MIN_ALPHA) * (1 - Math.abs(position)) + MIN_ALPHA);
float transX = pageWidth * -position;
view.setTranslationX(transX);
float scale = (DEFAULT_SCALE - 1.0f) * (1 - Math.abs(position)) + 1;
imgView.setScaleX(scale);
imgView.setScaleY(scale);
} else if (position <= 1) { // (0,1]
imgView.setAlpha(1.0f);
imgView.setScaleX(DEFAULT_SCALE);
imgView.setScaleY(DEFAULT_SCALE);
} else { // (1,+Infinity]
// This page is way off-screen to the right.
}
}
示例2: loadImage
import android.widget.ImageView; //导入方法依赖的package包/类
public static void loadImage(Context context, String url, ImageView imageView) {
// 夜间模式的处理
if (SPUtil.getBoolean(Constants.IS_NIGHT_MODE)) {
imageView.setAlpha(0.2f);
imageView.setBackgroundColor(Color.BLACK);
}
Glide.with(context).load(url).into(imageView);
}
示例3: doubleTrouble
import android.widget.ImageView; //导入方法依赖的package包/类
public void doubleTrouble (View myView){
/* Now we will have one image slide off the screen
* and another image slide into it's place. Note that one
* of the images is offscreen in the on create methode below.
*/
// Define the image views to use.
ImageView firstPic = (ImageView) findViewById(R.id.imageView2);
ImageView secondPic = (ImageView) findViewById(R.id.imageView3);
// Set the alpha (not really needed here, was used in other exercises.
// Used here to make them "dimmer" at half brightness.
firstPic.setAlpha(0.5f);
secondPic.setAlpha(0.5f);
// Call the translation (movement) and set the duration.
firstPic.animate().translationXBy(-1000f).setDuration(1500);
secondPic.animate().translationXBy(-1000f).setDuration(1500);
}
示例4: changeTypeButton
import android.widget.ImageView; //导入方法依赖的package包/类
private void changeTypeButton(Button button, int type) {
ImageView coins = (ImageView) mViewDetails.findViewById(R.id
.reward_coins_icon);
switch (type) {
case ENABLE_BUTTON:
coins.setAlpha(1);
button.setAlpha(1);
button.setEnabled(true);
break;
case DISABLE_BUTTON:
coins.setAlpha(ALPHA);
button.setAlpha(ALPHA);
button.setEnabled(false);
break;
default:
break;
}
}
示例5: setResult
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void setResult(ImageView imageView, LoadTaskItem taskItem) {
if (DBG) Log.d(TAG, "setResult");
boolean animate = true;
if (taskItem.loadObject instanceof ScraperImage) {
ScraperImage image = (ScraperImage) taskItem.loadObject;
String file = image.getLargeFile();
if (file != null && file.equals(lastLoaded)) {
//!!!animate = false;
if (DBG) Log.d(TAG, "setResult animate false");
}
lastLoaded = file;
}
imageView.setImageBitmap(taskItem.result.bitmap);
if (animate) {
Log.d(TAG, " animate backdrop alpha "+mBackgroundAlpha);
imageView.animate().alpha(mBackgroundAlpha).setDuration(600);
}
else {
Log.d(TAG, " set backdrop alpha"+mBackgroundAlpha);
imageView.setAlpha(mBackgroundAlpha);
}
}
示例6: updateScanData
import android.widget.ImageView; //导入方法依赖的package包/类
private void updateScanData(List<GlucoseData> trend) {
if (trend.size() == 0) {
Toast.makeText(this.getContext(), "No current data available!", Toast.LENGTH_LONG).show();
return;
}
mDataPlotView.findViewById(R.id.scan_data).setVisibility(View.VISIBLE);
GlucoseData currentGlucose = trend.get(trend.size() - 1);
TextView tv_currentGlucose = (TextView) mDataPlotView.findViewById(R.id.tv_glucose_current_value);
tv_currentGlucose.setText(
String.format(getResources().getString(R.string.glucose_current_value),
currentGlucose.glucoseString(),
getDisplayUnit())
);
PredictionData predictedGlucose = new PredictionData(trend);
TextView tv_predictedGlucose = (TextView) mDataPlotView.findViewById(R.id.tv_glucose_prediction);
tv_predictedGlucose.setText(String.valueOf(predictedGlucose.glucoseData.glucoseString()));
tv_predictedGlucose.setAlpha((float) min(1, 0.1 + predictedGlucose.confidence()));
ImageView iv_unit = (ImageView) mDataPlotView.findViewById(R.id.iv_unit);
if (GLUCOSE_UNIT_IS_MMOL) {
iv_unit.setImageResource(R.drawable.ic_unit_mmoll);
} else {
iv_unit.setImageResource(R.drawable.ic_unit_mgdl);
}
iv_unit.setAlpha((float) min(1, 0.1 + predictedGlucose.confidence()));
ImageView iv_predictionArrow = (ImageView) mDataPlotView.findViewById(R.id.iv_glucose_prediction);
// rotate trend arrow according to glucose prediction slope
float rotationDegrees = -90f * max(-1f, min(1f, (float) (predictedGlucose.glucoseSlopeRaw / TREND_UP_DOWN_LIMIT)));
iv_predictionArrow.setRotation(rotationDegrees);
// reduce trend arrow visibility according to prediction confidence
iv_predictionArrow.setAlpha((float) min(1, 0.1 + predictedGlucose.confidence()));
}
示例7: addTrainToScreen
import android.widget.ImageView; //导入方法依赖的package包/类
private void addTrainToScreen(Rect trainRect) {
rootView = new FrameLayout(this);
engineView = addTrain(trainRect, TrainView.ENGINE, rootView);
for (int i = 0; i < NUMBER_OF_CARS; i++) {
carsView.add(addTrain(trainRect, TrainView.CAR, rootView));
}
rootView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fadeOutActivity();
}
});
float iconToWidthFactor = 0.34f;
ImageView startRoof = new ImageView(this);
startRoof.setImageResource(R.drawable.long_start_point_roof);
int trainRectSize = (int) (trainRect.width() * (1f - iconToWidthFactor));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(trainRectSize, trainRectSize);
startRoof.setX(trainRect.left + trainRect.width() * iconToWidthFactor / 2 - 15);
startRoof.setY(trainRect.top + trainRect.width() * iconToWidthFactor / 2);
rootView.addView(startRoof, lp);
startRoof.setAlpha(0f);
startRoof.animate()
.alpha(1f)
.setInterpolator(new DecelerateInterpolator())
.setDuration(500)
.start();
setContentView(rootView);
}
示例8: loadThumbnail
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* Load thumbnails for a directory list item.
* @param uri The URI for the file being represented.
* @param mimeType The mime type of the file being represented.
* @param docFlags Flags for the file being represented.
* @param iconThumb The itemview's thumbnail icon.
* @param iconMimeBackground
* @return
*/
public void loadThumbnail(Uri uri, String path, String mimeType, int docFlags, int docIcon,
ImageView iconMime, ImageView iconThumb, View iconMimeBackground) {
boolean cacheHit = false;
final String docAuthority = uri.getAuthority();
String docId = DocumentsContract.getDocumentId(uri);
final boolean supportsThumbnail = (docFlags & Document.FLAG_SUPPORTS_THUMBNAIL) != 0;
final boolean allowThumbnail = MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mimeType);
final boolean showThumbnail = supportsThumbnail && allowThumbnail && mThumbnailsEnabled;
if (showThumbnail) {
final Bitmap cachedResult = mCache.get(uri);
if (cachedResult != null) {
iconThumb.setImageBitmap(cachedResult);
cacheHit = true;
iconMimeBackground.setVisibility(View.GONE);
} else {
iconThumb.setImageDrawable(null);
final LoaderTask task = new LoaderTask(uri, path, mimeType, mThumbSize, iconThumb,
iconMime, iconMimeBackground);
iconThumb.setTag(task);
ProviderExecutor.forAuthority(docAuthority).execute(task);
}
}
if (cacheHit) {
iconMime.setImageDrawable(null);
iconMime.setAlpha(0f);
iconThumb.setAlpha(1f);
} else {
// Add a mime icon if the thumbnail is being loaded in the background.
iconThumb.setImageDrawable(null);
iconMime.setImageDrawable(getDocumentIcon(mContext, docAuthority, docId, mimeType, docIcon));
iconMime.setAlpha(1f);
iconThumb.setAlpha(0f);
}
}
示例9: RadioButton
import android.widget.ImageView; //导入方法依赖的package包/类
public RadioButton(int unSelected,int selected,String string) {
v=inflater.inflate(ID_LAYOUT, null);
top=(ImageView)v.findViewById(ID_IMAGE_TOP);
bottom=(ImageView)v.findViewById(ID_IMAGE_BOTTOM);
text=(TextView)v.findViewById(ID_TEXT);
news=(TextView)v.findViewById(ID_NEWS);
top.setImageResource(unSelected);
top.setAlpha(1.0f);
bottom.setImageResource(selected);
bottom.setAlpha(0.0f);
text.setText(string);
news.setVisibility(INVISIBLE);
v.setLayoutParams(itemLayoutParams);
}
示例10: initView
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void initView() {
LogUtil.e("initMain123");
RecentFragment recentFragment = new RecentFragment();
ContactsFragment contactsFragment = new ContactsFragment();
InvitationFragment invitationFragment = new InvitationFragment();
ShareMessageFragment shareMessageFragment = new ShareMessageFragment();
mFragments[0] = recentFragment;
mFragments[1] = contactsFragment;
mFragments[2] = invitationFragment;
mFragments[3] = shareMessageFragment;
container = (DragLayout) findViewById(R.id.drag_container);
menuDisplay = (RecyclerView) findViewById(R.id.rev_menu_display);
nick = (TextView) findViewById(R.id.tv_menu_nick);
signature = (TextView) findViewById(R.id.tv_menu_signature);
avatar = (RoundAngleImageView) findViewById(R.id.riv_menu_avatar);
headLayout = (RelativeLayout) findViewById(R.id.rl_menu_head_layout);
bg = (ImageView) findViewById(R.id.iv_main_bg);
net = (TextView) findViewById(R.id.tv_main_net);
weatherCity = (TextView) findViewById(R.id.tv_menu_weather_city);
weatherTemperature = (TextView) findViewById(R.id.tv_menu_weather_temperature);
bottomLayout = (LinearLayout) findViewById(R.id.ll_menu_bottom_container);
bg.setAlpha((float) 0.0);
menuDisplay.setLayoutManager(new LinearLayoutManager(this));
menuDisplay.setHasFixedSize(true);
menuDisplay.setItemAnimator(new DefaultItemAnimator());
container.setListener(this);
headLayout.setOnClickListener(this);
net.setOnClickListener(this);
bottomLayout.setOnClickListener(this);
initActionBarView();
}
示例11: onViewCreated
import android.widget.ImageView; //导入方法依赖的package包/类
public void onViewCreated(View v, Bundle save){
super.onViewCreated(v, save);
ImageViewSetterConfiguration config = ImageViewSetterConfiguration.Builder.createNew()
.setUseCache(false)
.build();
mApplicationFrameLayout = ((MainActivity) getActivity()).getGlobalBackdropView();
mApplicationBackdrop = (ImageView) (((MainActivity) getActivity()).getGlobalBackdropView().findViewById(R.id.backdrop));
mApplicationBackdrop.setAlpha(0f);
mBackgroundSetter = new ImageViewSetter(getActivity(), config);
mHeaderView = LayoutInflater.from(getContext()).inflate(R.layout.browser_item_header_show, null);
mHeaderView.findViewById(R.id.loading).setVisibility(View.VISIBLE);
addHeaderView();
}
示例12: transformPage
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void transformPage(ImageView ivBg, float position, int direction) {
float mFraction = (float) Math.cos(2 * Math.PI * position);
if (mFraction < 0)
mFraction = 0;
ivBg.setAlpha(mFraction);
}
示例13: setFirstItemOrNormal
import android.widget.ImageView; //导入方法依赖的package包/类
private void setFirstItemOrNormal(BaseViewHolder helper){
ImageView ivRename=helper.getView(R.id.iv_edit_folder_rename);
CheckBox checkBox=helper.getView(R.id.cb_edit_folder);
RelativeLayout rlRoot=helper.getView(R.id.rl_edit_folder);
// 第一行(随手记)不可编辑
if(helper.getLayoutPosition()==0){
checkBox.setAlpha(0.26F);
rlRoot.setClickable(false);
} else {
ivRename.setAlpha(0.54F);
ivRename.setClickable(true);
checkBox.setAlpha(0.87F);
rlRoot.setClickable(true);
}
}
示例14: addPagerData
import android.widget.ImageView; //导入方法依赖的package包/类
public void addPagerData(PageBean bean, ViewPager viewPager) {
if (bean != null){
mCount = bean.datas.size();
//这里加小圆点
for (int i = 0; i < mCount; i++) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
if (i == mCount - 1){ //防止indicator的宽度为wrap_content,放大后被遮盖住的问题
params.setMargins(mLeftMargin,0,mLeftMargin,0);
}else{
params.setMargins(mLeftMargin,0,0,0);
}
ImageView imageView = new ImageView(mContext);
/* if (mSelector == 0){
}else {
}*/
imageView.setBackgroundResource(mSelector);
imageView.setLayoutParams(params);
imageView.setAlpha(mAlpha_min);
addView(imageView);
}
}
if (bean.openview != null){
mOpenView = bean.openview;
}
if (viewPager != null){
viewPager.addOnPageChangeListener(this);
}
}
示例15: startDragging
import android.widget.ImageView; //导入方法依赖的package包/类
private void startDragging(Bitmap bm, int x, int y) {
stopDragging();
mWindowParams = new WindowManager.LayoutParams();
mWindowParams.gravity = Gravity.TOP | Gravity.START;
mWindowParams.x = x;
mWindowParams.y = y - mDragPoint + mCoordOffset;
mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
mWindowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
mWindowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
mWindowParams.format = PixelFormat.TRANSLUCENT;
mWindowParams.windowAnimations = 0;
Context context = getContext();
ImageView v = new ImageView(context);
int backGroundColor = context.getResources().getColor(R.color.dragndrop_background);
v.setAlpha((float) 0.7);
v.setBackgroundColor(backGroundColor);
v.setImageBitmap(bm);
mDragBitmap = bm;
mWindowManager = (WindowManager) context.getSystemService("window");
mWindowManager.addView(v, mWindowParams);
mDragView = v;
}