本文整理匯總了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;
}