當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.setAlpha方法代碼示例

本文整理匯總了Java中android.widget.TextView.setAlpha方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setAlpha方法的具體用法?Java TextView.setAlpha怎麽用?Java TextView.setAlpha使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setAlpha方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUnreadCount

import android.widget.TextView; //導入方法依賴的package包/類
public void setUnreadCount(int unreadCount, final AnimationPNGSequence.IAnimationListener listener) {
    final TextView badgeCountText = (TextView) findViewById(R.id.text_badge_count);
    badgeCountText.setAlpha(0.0f);
    if (unreadCount == 0) {
        badgeCountText.setText("0");
        getHeadAnimation().playAnimation("IDLE");
        return;
    }
    String nextText = String.format("%d", new Object[]{Integer.valueOf(unreadCount)});
    getHeadAnimation().playAnimation("IDLE_BACK");
    badgeCountText.setText(nextText);
    badgeCountText.setAlpha(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    badgeCountText.setScaleX(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    badgeCountText.setScaleY(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    badgeCountText.animate().scaleY(1.3f).scaleX(1.3f).setDuration(200).withEndAction(new Runnable() {
        public void run() {
            badgeCountText.animate().scaleY(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).scaleX(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).setDuration(200).withEndAction(new Runnable() {
                public void run() {
                    if (listener != null) {
                        listener.onAnimationFinished();
                    }
                }
            });
        }
    });
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:27,代碼來源:YettiTabLayout.java

示例2: onViewCreated

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onViewCreated(View contentView) {
	super.onViewCreated(contentView);
	TextView left = titleBar.getLeftTextView();
	TextView right = titleBar.getRightTextView();
	Context context = getContext();
	Resources resources = context.getResources();

	left.setTextColor(resources.getColor(ResHelper.getColorRes(context, "bbs_white")));
	right.setTextColor(resources.getColor(ResHelper.getColorRes(context, "bbs_white")));
	left.setAlpha(0.8f);
	right.setAlpha(0.8f);
	right.setText(getStringRes("theme0_title_confirm"));
	Theme0StyleModifier.setTextSize(left, "bbs_theme0_writethread_left_txt_size");
	Theme0StyleModifier.setTextSize(right, "bbs_theme0_writethread_right_txt_size");
	Theme0StyleModifier.modifyUniformBlueStyle(this);
}
 
開發者ID:MobClub,項目名稱:BBSSDK-for-Android,代碼行數:18,代碼來源:Theme0PageWriteThread.java

示例3: updateScanData

import android.widget.TextView; //導入方法依賴的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()));
}
 
開發者ID:DorianScholz,項目名稱:OpenLibre,代碼行數:40,代碼來源:DataPlotFragment.java

示例4: initCountryText

import android.widget.TextView; //導入方法依賴的package包/類
private void initCountryText() {
    countryAnimDuration = getResources().getInteger(R.integer.cs_labels_animation_duration);
    countryOffset1 = getResources().getDimensionPixelSize(R.dimen.cs_left_offset);
    countryOffset2 = getResources().getDimensionPixelSize(R.dimen.cs_card_width);
    country1TextView = (TextView) findViewById(R.id.cs_tv_country_1);
    country2TextView = (TextView) findViewById(R.id.cs_tv_country_2);

    country1TextView.setX(countryOffset1);
    country2TextView.setX(countryOffset2);
    country1TextView.setText(countries[0]);
    country2TextView.setAlpha(0f);

    country1TextView.setTypeface(Typeface.createFromAsset(getAssets(), "open-sans-extrabold.ttf"));
    country2TextView.setTypeface(Typeface.createFromAsset(getAssets(), "open-sans-extrabold.ttf"));
}
 
開發者ID:Ramotion,項目名稱:showroom-android,代碼行數:16,代碼來源:CardSliderActivity.java

示例5: onLayout

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    if (dotRunnable != null) {
        AndroidUtilities.cancelRunOnUIThread(dotRunnable);
        dotRunnable = null;
    }
    if (currentAnimation != null) {
        currentAnimation.cancel();
        currentAnimation = null;
    }

    for (int a = 0; a < 4; a++) {
        if (a < stringBuilder.length()) {
            TextView textView = characterTextViews.get(a);
            textView.setAlpha(0);
            textView.setScaleX(1);
            textView.setScaleY(1);
            textView.setTranslationY(0);
            textView.setTranslationX(getXForTextView(a));

            textView = dotTextViews.get(a);
            textView.setAlpha(1);
            textView.setScaleX(1);
            textView.setScaleY(1);
            textView.setTranslationY(0);
            textView.setTranslationX(getXForTextView(a));
        } else {
            characterTextViews.get(a).setAlpha(0);
            dotTextViews.get(a).setAlpha(0);
        }
    }
    super.onLayout(changed, left, top, right, bottom);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:34,代碼來源:PasscodeView.java

示例6: onViewCreated

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onViewCreated(View contentView) {
	TextView left = titleBar.getLeftTextView();
	Context context = getContext();
	Resources resources = context.getResources();

	left.setTextColor(resources.getColor(ResHelper.getColorRes(context, "bbs_white")));
	left.setAlpha(0.8f);
	Theme0StyleModifier.setTextSize(left, "bbs_theme0_writethread_left_txt_size");
	Theme0StyleModifier.modifyUniformBlueStyle(this);
	super.onViewCreated(contentView);
}
 
開發者ID:MobClub,項目名稱:BBSSDK-for-Android,代碼行數:13,代碼來源:Theme0PageSelectForum.java

示例7: setViewText

import android.widget.TextView; //導入方法依賴的package包/類
private void setViewText(TextView view, CharSequence text, boolean animate) {
    if (view.getText().toString().equals(text)) return;
    view.animate().cancel();
    if (animate) {
        view.setAlpha(0.0f);
        view.setText(text);
        view.animate().alpha(1.f).setDuration(mAnimationDuration).setListener(null);
    } else {
        view.setText(text);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:12,代碼來源:SnackbarView.java

示例8: initCountryText

import android.widget.TextView; //導入方法依賴的package包/類
private void initCountryText() {
    countryAnimDuration = getResources().getInteger(R.integer.labels_animation_duration);
    countryOffset1 = getResources().getDimensionPixelSize(R.dimen.left_offset);
    countryOffset2 = getResources().getDimensionPixelSize(R.dimen.card_width);
    country1TextView = (TextView) findViewById(R.id.tv_country_1);
    country2TextView = (TextView) findViewById(R.id.tv_country_2);

    country1TextView.setX(countryOffset1);
    country2TextView.setX(countryOffset2);
    country1TextView.setText(countries[0]);
    country2TextView.setAlpha(0f);

    country1TextView.setTypeface(Typeface.createFromAsset(getAssets(), "open-sans-extrabold.ttf"));
    country2TextView.setTypeface(Typeface.createFromAsset(getAssets(), "open-sans-extrabold.ttf"));
}
 
開發者ID:Ramotion,項目名稱:cardslider-android,代碼行數:16,代碼來源:MainActivity.java

示例9: showToast

import android.widget.TextView; //導入方法依賴的package包/類
private static void showToast(Context context, String message) {
    View view;
    mHandler.removeCallbacks(runnable);
    LayoutInflater inflater = LayoutInflater.from(context);
    view = inflater.inflate(R.layout.toast_style_layout, null);
    TextView textView = (TextView) view.findViewById(R.id.toast_text);
    textView.setAlpha(0.5f);
    textView.setText(message);

    toast = new Toast(context);
    toast.setView(view);
    toast.show();
    mHandler.postDelayed(runnable,1000);

}
 
開發者ID:forplane,項目名稱:head,代碼行數:16,代碼來源:ToastUtils.java

示例10: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    vViewPager = (ViewPager) findViewById(R.id.viewpager);
    vTimes = (LinearLayout) findViewById(R.id.times_layout);
    vTimetableModifiedLabel = (TextView) findViewById(R.id.timetable_modify_date_label);
    vTimetableCheckedLabel = (TextView) findViewById(R.id.timetable_check_date_label);
    vTimetableModified = (TextView) findViewById(R.id.timetable_modify_date);
    vTimetableChecked = (TextView) findViewById(R.id.timetable_check_date);

    vTimetableModifiedLabel.setAlpha(0.33F);
    vTimetableCheckedLabel.setAlpha(0.33F);
    vTimetableModified.setAlpha(0.33F);
    vTimetableChecked.setAlpha(0.33F);

    TimetableUtils.attach(this);

    String selectedTtFilename = DataUtils.getTimetableSelection(this);
    Timetable selectedTt = PoskaApplication.timetables.getPeriod(selectedTtFilename);
    if (selectedTt == null) {
        if (!isTimetableSet) {
            for (String filename : PoskaApplication.timetables.timetables.keySet()) {
                Timetable tt = PoskaApplication.timetables.getPeriod(filename);
                setTimetable(tt, true, true);
                isTimetableSet = tt != null;
                break;
            }
        }
    } else {
        setTimetable(selectedTt, true, true);
        isTimetableSet = true;
    }
    if (!isTimetableSet) {
        DataUtils.setTimetableSelection(this, null);
    }
    TimetableFilter tf = DataUtils.getTimetableFilter(this);
    if (tf != null) setTimetableFilter(tf, false, true);
}
 
開發者ID:gregoreesmaa,項目名稱:minu-poska-android,代碼行數:40,代碼來源:TimeTableBaseActivity.java

示例11: initCommonView

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * 初始化公共的控件
 */
private void initCommonView() {
    // 實例化灰色半透明蒙版控件
    _backMaskView = new View(_context);
    _backMaskView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (_currentInfo.getEventDelegate() != null)
                _currentInfo.getEventDelegate().onMaskTouch(LemonHelloView.this, _currentInfo);
        }
    });
    // 設置全屏寬
    _backMaskView.setLayoutParams(new RelativeLayout.LayoutParams(_PST.dpToPx(_PST.screenWidthDp()), _PST.dpToPx(_PST.screenHeightDp())));
    _rootLayout.setAlpha(0);// 設置全透明,也就是默認不可見,後期通過動畫改變來顯示

    // 實例化內容麵板控件
    _contentPanel = new LemonHelloPanel(_context);
    _contentPanel.setX(_PST.dpToPx((int) (_PST.screenWidthDp() / 2.0)));
    _contentPanel.setY(_PST.dpToPx((int) (_PST.screenHeightDp() / 2.0)));

    // 實例化內容麵板控件的布局
    _contentLayout = new RelativeLayout(_context);

    // 實例化繪圖動畫和幀圖片顯示的控件
    _paintView = new LemonPaintView(_context);

    // 實例化標題顯示標簽控件
    _titleView = new TextView(_context);
    _titleView.setX(0);
    _titleView.setY(0);
    _titleView.setGravity(Gravity.CENTER);

    _contentView = new TextView(_context);
    _contentView.setX(0);
    _contentView.setY(0);
    _contentView.setGravity(Gravity.CENTER);

    _actionContainer = new RelativeLayout(_context);
    _actionContainer.setX(0);
    _actionContainer.setY(0);

    _contentView.setAlpha(0);
    _titleView.setAlpha(0);
    _contentPanel.setAlpha(0);

    // 把所有控件添加到根視圖上
    _rootLayout.addView(_backMaskView);// 半透明灰色背景
    _rootLayout.addView(_contentPanel);// 主內容麵板
    _contentPanel.addView(_contentLayout);
    _contentLayout.addView(_paintView);// 動畫和幀圖標顯示控件放置到內容麵板上
    _contentLayout.addView(_titleView);// 標題顯示標簽控件放置到內容麵板上
    _contentLayout.addView(_contentView);// 正文內容顯示標簽控件放到內容麵板上
    _contentLayout.addView(_actionContainer);// action事件容器放到內容麵板中
}
 
開發者ID:LemonAppCN,項目名稱:LemonHello4Android,代碼行數:57,代碼來源:LemonHelloView.java

示例12: getView

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View view, ViewGroup parent) {
    final CalendarItem currentItem = days.get(position);

    if (view == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(layoutResId, null);
    }

    if (viewInteractor != null && viewInteractor.hasImplementedMonthCellBinding()) {
        view = viewInteractor.onMonthCellBindView(view, currentItem);
    } else {
        final TextView dayView = view.findViewById(android.R.id.title);
        final View background = view.findViewById(android.R.id.background);
        final View startSelectionView = view.findViewById(android.R.id.startSelectingText);
        final View endSelectionView = view.findViewById(android.R.id.stopSelectingText);

        startSelectionView.setVisibility(View.GONE);
        endSelectionView.setVisibility(View.GONE);

        if (currentItem == null) {
            background.setBackground(null);
            dayView.setText(null);
        } else if (currentItem.compareTo(calendar.getFirstMonth().withMillisOfDay(0)) < 0) {
            currentItem.setSelectable(false);
            background.setBackground(null);
            dayView.setTextColor(Color.BLACK);
            dayView.setText(currentItem.getDayString());
            dayView.setAlpha(0.6f);
        } else {
            currentItem.setSelectable(true);
            dayView.setAlpha(1f);
            Integer backgroundResource = null;
            if (firstSelectedDay != null) {
                int startSelectedCompared = currentItem.compareTo(firstSelectedDay);
                if (!multipleSelection) {
                    if (startSelectedCompared == 0) {
                        backgroundResource = R.drawable.empty_circle;
                    }
                } else if (startSelectedCompared == 0) {
                    if (lastSelectedDay == null || lastSelectedDay.equals(currentItem.getDateTime())) {
                        backgroundResource = R.drawable.circle;
                    } else {
                        backgroundResource = R.drawable.left_rounded_rectangle;
                        endSelectionView.setVisibility(View.VISIBLE);
                    }
                } else if (startSelectedCompared > 0 && lastSelectedDay != null) {
                    int endSelectedCompared = currentItem.compareTo(lastSelectedDay);
                    if (endSelectedCompared == 0) {
                        backgroundResource = R.drawable.right_rounded_rectangle;
                        startSelectionView.setVisibility(View.VISIBLE);
                    } else if (endSelectedCompared < 0) {
                        backgroundResource = R.drawable.rectangle;
                        startSelectionView.setVisibility(View.VISIBLE);
                        endSelectionView.setVisibility(View.VISIBLE);
                    }
                }
            }

            int color = Color.BLACK;
            if (backgroundResource != null) {
                background.setBackgroundResource(backgroundResource);
                if (multipleSelection) {
                    color = Color.WHITE;
                }
            } else {
                background.setBackground(null);
            }

            dayView.setTextColor(color);
            dayView.setText(currentItem.getDayString());
        }
    }

    return view;
}
 
開發者ID:MOLO17,項目名稱:CustomizableCalendar,代碼行數:77,代碼來源:MonthAdapter.java

示例13: animation

import android.widget.TextView; //導入方法依賴的package包/類
private void animation() {
    TextView textView = (TextView) findViewById(R.id.zysit_text_logo);
    textView.setAlpha(1.0F);
    Animation localAnimation = AnimationUtils.loadAnimation(this, R.anim.translate_top_to_center);
    textView.startAnimation(localAnimation);
}
 
開發者ID:EseCoder,項目名稱:cryptotracker,代碼行數:7,代碼來源:SplashScreenActivity.java


注:本文中的android.widget.TextView.setAlpha方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。