当前位置: 首页>>代码示例>>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;未经允许,请勿转载。