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


Java TextView.setY方法代碼示例

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


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

示例1: PlayerView

import android.widget.TextView; //導入方法依賴的package包/類
public PlayerView(Context context, SimpleExoPlayer player) {
    super(context);
    simpleExoPlayerView = new SimpleExoPlayerView(context);
    progressBar = new ProgressBar(context);
    textView = new TextView(context);
    textView.setX(40);
    textView.setY(20);
    textView.setTextColor(Color.parseColor("#FFFFFF"));
    textView.setTextSize(16);
    textView.setText("By Herudi");
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(100,100);
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    simpleExoPlayerView.setLayoutParams(new SimpleExoPlayerView.LayoutParams(
            SimpleExoPlayerView.LayoutParams.MATCH_PARENT,
            SimpleExoPlayerView.LayoutParams.MATCH_PARENT
    ));
    setLayoutParams(new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT,
            RelativeLayout.LayoutParams.WRAP_CONTENT
    ));
    setBackgroundColor(ContextCompat.getColor(context, android.R.color.black));
    addView(simpleExoPlayerView);
    addView(textView);
    addView(progressBar,params);
    simpleExoPlayerView.setUseController(true);
    simpleExoPlayerView.requestFocus();
    simpleExoPlayerView.setPlayer(player);
    simpleExoPlayerView.setControllerVisibilityListener(new PlaybackControlView.VisibilityListener() {
        @Override
        public void onVisibilityChange(int visibility) {
            if (visibility==0){
                textView.setVisibility(VISIBLE);
            }else {
                textView.setVisibility(GONE);
            }
        }
    });
}
 
開發者ID:herudi,項目名稱:react-native-exoplayer-intent-video,代碼行數:39,代碼來源:PlayerView.java

示例2: ondrawIndicator

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void ondrawIndicator()
{
    if(mTextContainer != null)
    {
        mTextContainer.removeAllViews();//clear ViewGroup
        List<Float> complectedXPosition = mStepsViewIndicator.getCircleCenterPointPositionList();
        if(mTexts != null && complectedXPosition != null && complectedXPosition.size() > 0)
        {
            for(int i = 0; i < mTexts.size(); i++)
            {
                mTextView = new TextView(getContext());
                mTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTextSize);
                mTextView.setText(mTexts.get(i));
                mTextView.setY(complectedXPosition.get(i) - mStepsViewIndicator.getCircleRadius() / 2);
                mTextView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

                if(i <= mComplectingPosition)
                {
                    mTextView.setTypeface(null, Typeface.BOLD);
                    mTextView.setTextColor(mComplectedTextColor);
                } else
                {
                    mTextView.setTextColor(mUnComplectedTextColor);
                }

                mTextContainer.addView(mTextView);
            }
        }
    }
}
 
開發者ID:dufangyu1990,項目名稱:JKApp,代碼行數:32,代碼來源:VerticalStepView.java

示例3: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_login);
	trackEvent(R.string.category_read, R.string.action_login);

	mLoginTextContainer 	= (RelativeLayout) findViewById(R.id.login_text_container);
	mWebViewProgress 		= (ProgressView) findViewById(R.id.SetupProgress);
	mWebViewContainer 		= (FrameLayout) findViewById(R.id.webview_container);
	mContinueFABContainer 	= (FrameLayout) findViewById(R.id.login_continue_circle_container);
	mGearIcon 				= (ImageView) findViewById(R.id.login_icon);
	mSuccessIcon 			= (ImageView) findViewById(R.id.login_icon_done);
	mContinueIcon			= (ImageView) findViewById(R.id.forward_arrow);
	mLoginTextLineOne 		= (TextView) findViewById(R.id.login_text_line_one);
	mLoginTextLineTwo 		= (TextView) findViewById(R.id.login_text_line_two);
	mSuccessMessage			= (TextView) findViewById(R.id.login_success_message);
	mSkipText				= (TextView) findViewById(R.id.skip_text);
	loginWebView 			= (WebView) findViewById(R.id.login_webview);
	mContinueFAB 			= findViewById(R.id.login_continue_circle);
	mContinueFABShadow 		= findViewById(R.id.login_continue_circle_shadow);
	mSuccessCircle 			= findViewById(R.id.login_success_circle);
	mSuccessCircleShadow	= findViewById(R.id.login_success_shadow);
	mTransitionViewWhite 	= findViewById(R.id.transition_view);
	mTransitionViewBlue 	= findViewById(R.id.transition_view_blue);

	mSuccessMessage		.setVisibility(View.INVISIBLE);
	mContinueIcon		.setVisibility(View.INVISIBLE);
	mSuccessCircleShadow.setVisibility(View.INVISIBLE);
	mSuccessIcon		.setVisibility(View.INVISIBLE);
	mSuccessCircle		.setVisibility(View.INVISIBLE);
	mLoginTextLineOne	.setVisibility(View.INVISIBLE);
	mLoginTextLineTwo	.setVisibility(View.INVISIBLE);
	loginWebView		.setVisibility(View.INVISIBLE);
	mGearIcon			.setVisibility(View.INVISIBLE);
	mTransitionViewBlue	.setVisibility(View.INVISIBLE);
	mTransitionViewWhite.setVisibility(View.INVISIBLE);
	mSkipText			.setVisibility(View.INVISIBLE);

	checkSetupType();

	float textPosition = (int) (2.5 * (getScreenHeight() / 5));
	mLoginTextContainer	.setY(textPosition);
	mSuccessMessage		.setY(textPosition);
	mContinueFABContainer.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			showLoginView();

			if (PocketPlaysApplication.isCrawlerUpdate)
				showSkippingAnimation();
		}
	});

	Service.bringToBack(mTransitionViewWhite);
	Service.bringToBack(mTransitionViewBlue);
	mLoginTextLineOne		.bringToFront();
	mLoginTextLineTwo		.bringToFront();

	initSkipView();
	initSnackbar();
	initLoginView();
	showLogoAnimations();
	showTextLineAnimations(mLoginTextLineOne, 1);
	showTextLineAnimations(mLoginTextLineTwo, 2);
	showTextLineAnimations(mSkipText, 2);

	AnimationSet animationSet = getContinueIconAnimations(270);
	animationSet.setStartOffset(SHOW_CONTINUE_ICON_DELAY);
	animationSet.start();
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:71,代碼來源:LoginActivity.java

示例4: 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


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