android.widget.RelativeLayout.LayoutParams Java Examples
The following examples show how to use
android.widget.RelativeLayout.LayoutParams.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseAndroidWidget.java From relight with Apache License 2.0 | 6 votes |
protected void mergeLayoutParams() { ViewGroup.LayoutParams lp = view.getLayoutParams(); if (!(lp instanceof RelativeLayout.LayoutParams)) { return; } if (null == relativeParams) { return; } RelativeLayout.LayoutParams rlp = (LayoutParams) lp; int[] rules = relativeParams.getRules(); for (int i = 0, n = rules.length; i < n; i++) { rlp.addRule(i, rules[i]); } rlp.alignWithParent = relativeParams.alignWithParent; view.setLayoutParams(rlp); }
Example #2
Source File: X8AiLineInterestPointController.java From FimiX8-RE with MIT License | 6 votes |
public void addTouchEvent() { this.view.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == 0) { X8AiLineInterestPointController.this.tmpView = new ImageView(X8AiLineInterestPointController.this.group.getContext()); X8AiLineInterestPointController.this.tmpView.setBackgroundResource(R.drawable.x8_img_ai_line_inreterst_max2); LayoutParams layoutParams = new LayoutParams(-2, -2); layoutParams.setMargins(X8AiLineInterestPointController.this.view.getLeft(), X8AiLineInterestPointController.this.view.getTop(), 0, 0); X8AiLineInterestPointController.this.group.addView(X8AiLineInterestPointController.this.tmpView, layoutParams); } else if (event.getAction() == 2) { LayoutParams lp = (LayoutParams) X8AiLineInterestPointController.this.tmpView.getLayoutParams(); lp.setMargins((X8AiLineInterestPointController.this.view.getLeft() + ((int) event.getX())) - (X8AiLineInterestPointController.this.tmpView.getWidth() / 2), (X8AiLineInterestPointController.this.view.getTop() + ((int) event.getY())) - ((int) (1.5f * ((float) X8AiLineInterestPointController.this.tmpView.getHeight()))), 0, 0); X8AiLineInterestPointController.this.tmpView.setLayoutParams(lp); } else if (event.getAction() == 1) { X8AiLineInterestPointController.this.listener.onUp(X8AiLineInterestPointController.this.view.getLeft() + ((int) event.getX()), X8AiLineInterestPointController.this.view.getTop() + ((int) event.getY())); X8AiLineInterestPointController.this.group.removeView(X8AiLineInterestPointController.this.tmpView); } return true; } }); }
Example #3
Source File: PKDialog.java From letv with Apache License 2.0 | 6 votes |
private void createViews() { this.mFlMain = new com.tencent.open.c.a((Context) this.mWeakContext.get()); this.mFlMain.setBackgroundColor(1711276032); this.mFlMain.setLayoutParams(new LayoutParams(-1, -1)); this.mWebView = new b((Context) this.mWeakContext.get()); this.mWebView.setBackgroundColor(0); this.mWebView.setBackgroundDrawable(null); if (VERSION.SDK_INT >= 11) { try { View.class.getMethod("setLayerType", new Class[]{Integer.TYPE, Paint.class}).invoke(this.mWebView, new Object[]{Integer.valueOf(1), new Paint()}); } catch (Exception e) { e.printStackTrace(); } } ViewGroup.LayoutParams layoutParams = new LayoutParams(-1, this.mWebviewHeight); layoutParams.addRule(13, -1); this.mWebView.setLayoutParams(layoutParams); this.mFlMain.addView(this.mWebView); this.mFlMain.a(this); setContentView(this.mFlMain); }
Example #4
Source File: CustomVideoView.java From FimiX8-RE with MIT License | 6 votes |
private void initView() { this.mPlayerView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.album_custom_video_view, this); this.mPlayerView.setOnClickListener(this); this.mLoadingBar = (ProgressBar) this.mPlayerView.findViewById(R.id.load_iv); this.mVideoView = (TextureView) this.mPlayerView.findViewById(R.id.play_video_textureview); this.mVideoView.setOnClickListener(this); this.mVideoView.setKeepScreenOn(true); this.mVideoView.setSurfaceTextureListener(this); this.mTopBarLl = (LinearLayout) this.mPlayerView.findViewById(R.id.shoto_top_tab_ll); this.mBottomPlayRl = (RelativeLayout) this.mPlayerView.findViewById(R.id.bottom_play_rl); this.mMiniPlayBtn = (ImageButton) this.mBottomPlayRl.findViewById(R.id.play_btn); this.mPlaySb = (SeekBar) this.mBottomPlayRl.findViewById(R.id.play_sb); this.mPlaySb.setOnSeekBarChangeListener(this); this.mMiniPlayBtn.setOnClickListener(this); this.mCurrentTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.time_current_tv); this.mTotalTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.total_time_tv); showBar(false); this.nameTv = (TextView) findViewById(R.id.photo_name_tv); this.mPlayBackIBtn = (ImageButton) findViewById(R.id.media_back_btn); this.mPlayBackIBtn.setOnClickListener(this); this.mPlayerView.setOnClickListener(this); LayoutParams params = new LayoutParams(this.mScreenWidth, this.mDestationHeight); params.addRule(13); this.mPlayerView.setLayoutParams(params); }
Example #5
Source File: PLView.java From panoramagl with Apache License 2.0 | 6 votes |
/** * This event is fired when GLSurfaceView is created * * @param glSurfaceView current GLSurfaceView */ @SuppressWarnings("deprecation") protected View onGLSurfaceViewCreated(GLSurfaceView glSurfaceView) { for (int i = 0; i < kMaxTouches; i++) mInternalTouches.add(new UITouch(glSurfaceView, new CGPoint(0.0f, 0.0f))); mContentLayout = new RelativeLayout(this); mContentLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mContentLayout.addView(glSurfaceView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); LayoutParams progressBarLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); progressBarLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); mProgressBar = new ProgressBar(this); mProgressBar.setIndeterminate(true); mProgressBar.setVisibility(View.GONE); mContentLayout.addView(mProgressBar, progressBarLayoutParams); return this.onContentViewCreated(mContentLayout); }
Example #6
Source File: ViewUtils.java From mobile-manager-tool with MIT License | 6 votes |
/** * get AbsListView height according to every children * * @param view * @return */ public static int getAbsListViewHeightBasedOnChildren(AbsListView view) { ListAdapter adapter; if (view == null || (adapter = view.getAdapter()) == null) { return 0; } int height = 0; for (int i = 0; i < adapter.getCount(); i++) { View item = adapter.getView(i, null, view); if (item instanceof ViewGroup) { item.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); } item.measure(0, 0); height += item.getMeasuredHeight(); } height += view.getPaddingTop() + view.getPaddingBottom(); return height; }
Example #7
Source File: Splash.java From KJFrameForAndroid with Apache License 2.0 | 6 votes |
/** * 屏幕适配 */ private void screenAdaptation() { RelativeLayout.LayoutParams boxParams = (LayoutParams) mRlBox .getLayoutParams(); boxParams.width = (int) (AppContext.screenW * 0.8); boxParams.height = (int) (AppContext.screenH * 0.6); mRlBox.setLayoutParams(boxParams); RelativeLayout.LayoutParams goParams = (LayoutParams) mBtnGo .getLayoutParams(); goParams.width = (int) (AppContext.screenW * 0.7); goParams.height = (int) getResources().getDimension( R.dimen.splash_btn_go_height); mBtnGo.setLayoutParams(goParams); RelativeLayout.LayoutParams headParams = (RelativeLayout.LayoutParams) mImgHead .getLayoutParams(); headParams.topMargin = (int) ((AppContext.screenH * 0.16) / 2); mImgHead.setLayoutParams(headParams); }
Example #8
Source File: MessageActivity.java From sctalk with Apache License 2.0 | 6 votes |
@Override public void onGlobalLayout() { Rect r = new Rect(); baseRoot.getGlobalVisibleRect(r); // 进入Activity时会布局,第一次调用onGlobalLayout,先记录开始软键盘没有弹出时底部的位置 if (rootBottom == Integer.MIN_VALUE) { rootBottom = r.bottom; return; } // adjustResize,软键盘弹出后高度会变小 if (r.bottom < rootBottom) { //按照键盘高度设置表情框和发送图片按钮框的高度 keyboardHeight = rootBottom - r.bottom; SystemConfigSp.instance().init(MessageActivity.this); SystemConfigSp.instance().setIntConfig(currentInputMethod, keyboardHeight); LayoutParams params = (LayoutParams) addOthersPanelView.getLayoutParams(); params.height = keyboardHeight; LayoutParams params1 = (LayoutParams) emoLayout.getLayoutParams(); params1.height = keyboardHeight; } }
Example #9
Source File: FeedDetailActivity.java From umeng_community_android with MIT License | 6 votes |
@SuppressWarnings("deprecation") private void initTitleLayout() { TextView titleTextView = (TextView) findViewById(ResFinder.getId( "umeng_comm_title_tv")); titleTextView.setText(ResFinder.getString("umeng_comm_feed_detail")); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); // back btn findViewById(ResFinder.getId("umeng_comm_title_back_btn")).setOnClickListener(this); // 刷新按钮 mRefreshButton = (ImageButton) findViewById(ResFinder.getId( "umeng_comm_title_setting_btn")); LayoutParams layoutParams = (LayoutParams) mRefreshButton.getLayoutParams(); layoutParams.width = DeviceUtils.dp2px(this, 20); layoutParams.height = DeviceUtils.dp2px(this, 20); layoutParams.rightMargin = DeviceUtils.dp2px(getApplicationContext(), 4); mRefreshButton.setLayoutParams(layoutParams); mRefreshButton.setBackgroundDrawable(ResFinder.getDrawable("umeng_comm_more")); mRefreshButton.setOnClickListener(new LoginOnViewClickListener() { @Override protected void doAfterLogin(View v) { mActionDialog.show(); } }); }
Example #10
Source File: ViewUtil.java From AndroidStudyDemo with GNU General Public License v2.0 | 6 votes |
/** * get AbsListView height according to every children * * @param view * @return */ public static int getAbsListViewHeightBasedOnChildren(AbsListView view) { ListAdapter adapter; if (view == null || (adapter = view.getAdapter()) == null) { return 0; } int height = 0; for (int i = 0; i < adapter.getCount(); i++) { View item = adapter.getView(i, null, view); if (item instanceof ViewGroup) { item.setLayoutParams(new LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); } item.measure(0, 0); height += item.getMeasuredHeight(); } height += view.getPaddingTop() + view.getPaddingBottom(); return height; }
Example #11
Source File: ImageDetailsActivity.java From MultiImageChooser with MIT License | 6 votes |
private void initData(){ image = (PhotoView) findViewById(R.id.source_img); image.enable(); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.text_image); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); layoutParams = new LayoutParams(ScreenUtil.getScreenWidth(), ScreenUtil.getScreenHeight()-toolbar.getHeight()); Intent intent = getIntent(); image.setImageBitmap(getBitmapFromUri(Uri.parse(intent.getStringExtra(getString(R.string.id_image_uri))))); image.setLayoutParams(layoutParams); }
Example #12
Source File: IRegionDisplay.java From CameraV with GNU General Public License v3.0 | 6 votes |
public IRegionDisplay(Context context, IRegion parent, IRegionDisplayListener listener) { super(context); this.parent = parent; bounds = parent.bounds; mListener = listener; lp = new LayoutParams(bounds.displayWidth, bounds.displayHeight); lp.leftMargin = bounds.displayLeft; lp.topMargin = bounds.displayTop; setLayoutParams(lp); activeD = context.getResources().getDrawable(R.drawable.extras_region_display_active); inactiveD = context.getResources().getDrawable(R.drawable.extras_region_display_inactive); setStatus(true); setOnClickListener(this); }
Example #13
Source File: ProgressBarDeterminate.java From MoeGallery with GNU General Public License v3.0 | 6 votes |
public void setProgress(int progress){ if(getWidth() == 0){ pendindProgress = progress; }else{ this.progress = progress; if(progress > max) progress = max; if(progress < min) progress = min; int totalWidth = max-min; double progressPercent = (double)progress/(double)totalWidth; int progressWidth =(int) (getWidth()*progressPercent); RelativeLayout.LayoutParams params = (LayoutParams) progressView.getLayoutParams(); params.width = progressWidth; params.height = getHeight(); progressView.setLayoutParams(params); pendindProgress = -1; } }
Example #14
Source File: MyPlayRecordFragment.java From letv with Apache License 2.0 | 6 votes |
protected void showDeleteLayout() { if (getActivity() != null && this.mHeaderLayout != null) { LayoutParams params = (LayoutParams) this.mPullListView.getLayoutParams(); if (!this.mIsDelete || this.mListAdapter == null || this.mListAdapter.getCount() <= 0) { params.bottomMargin = 0; this.mHeaderLayout.setVisibility(8); upDateLogin(); return; } this.mHeaderLayout.setVisibility(0); if (this.mHeaderLayout.getHeight() == 0) { params.bottomMargin = ((UIs.zoomRealHeight(50) * 3) / 4) + 1; } else { params.bottomMargin = this.mHeaderLayout.getHeight(); } this.mPullListView.setLayoutParams(params); } }
Example #15
Source File: CuxtomCamActivity.java From CuXtomCam with Apache License 2.0 | 6 votes |
/** * initialize video recording UI with timer */ private void initVideoRecordingUI(String initializeTime) { LayoutParams rl_param = new LayoutParams( android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT); rl_param.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); rl_param.addRule(RelativeLayout.CENTER_HORIZONTAL); rl_param.addRule(RelativeLayout.ALIGN_BOTTOM, mPreview.getId()); rl_param.setMargins(0, 0, 0, 30); tv_recordingDuration.setText(initializeTime); tv_recordingDuration.setTextSize(28); tv_recordingDuration.setLayoutParams(rl_param); previewCameraLayout.addView(tv_recordingDuration); mExecutorService = Executors.newSingleThreadScheduledExecutor(); totalVideoDuration = 0; mExecutorService.scheduleAtFixedRate(recordingTimer, 1, 1, TimeUnit.SECONDS); }
Example #16
Source File: PLManager.java From panoramagl with Apache License 2.0 | 6 votes |
/** * This event is fired when GLSurfaceView is created * * @param glSurfaceView current GLSurfaceView */ @SuppressWarnings("deprecation") protected View onGLSurfaceViewCreated(GLSurfaceView glSurfaceView) { for (int i = 0; i < kMaxTouches; i++) mInternalTouches.add(new UITouch(glSurfaceView, new CGPoint(0.0f, 0.0f))); mContentLayout = new RelativeLayout(context); mContentLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mContentLayout.addView(glSurfaceView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); LayoutParams progressBarLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); progressBarLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); mProgressBar = new ProgressBar(context); mProgressBar.setIndeterminate(true); mProgressBar.setVisibility(View.GONE); mContentLayout.addView(mProgressBar, progressBarLayoutParams); return this.onContentViewCreated(mContentLayout); }
Example #17
Source File: LiveFragment.java From letv with Apache License 2.0 | 6 votes |
private void initHeaderView() { this.mHeaderView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.view_live_header, null); this.mViewpager = (ViewPager) this.mHeaderView.findViewById(R.id.view_live_header_viewpager); this.mRecyclerview = (RecyclerView) this.mHeaderView.findViewById(R.id.view_live_header_recyclerview); this.mIvSingle = (ImageView) this.mHeaderView.findViewById(R.id.view_live_header_iv_single); this.mIvDouble = (ImageView) this.mHeaderView.findViewById(R.id.view_live_header_iv_double); this.mHeaderView.setClipChildren(false); int width = UIsUtils.getScreenWidth() - UIsUtils.dipToPx(40.0f); this.mViewPagerHeight = (width * 240) / 320; LayoutParams params = (LayoutParams) this.mViewpager.getLayoutParams(); params.width = width; params.height = this.mViewPagerHeight; this.mViewpager.setLayoutParams(params); initHeaderImageView(); initViewPager(); initRecyclerView(); this.mListView.addHeaderView(this.mHeaderView); }
Example #18
Source File: PopupManager.java From AndroidAnimationExercise with Apache License 2.0 | 6 votes |
public static void showPopupWon(GameState gameState) { RelativeLayout popupContainer = (RelativeLayout) Shared.activity.findViewById(R.id.popup_container); popupContainer.removeAllViews(); // popup PopupWonView popupWonView = new PopupWonView(Shared.context); popupWonView.setGameState(gameState); int width = Shared.context.getResources().getDimensionPixelSize(R.dimen.popup_won_width); int height = Shared.context.getResources().getDimensionPixelSize(R.dimen.popup_won_height); LayoutParams params = new LayoutParams(width, height); params.addRule(RelativeLayout.CENTER_IN_PARENT); popupContainer.addView(popupWonView, params); // animate all together ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(popupWonView, "scaleX", 0f, 1f); ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(popupWonView, "scaleY", 0f, 1f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(scaleXAnimator, scaleYAnimator); animatorSet.setDuration(500); animatorSet.setInterpolator(new DecelerateInterpolator(2)); popupWonView.setLayerType(View.LAYER_TYPE_HARDWARE, null); animatorSet.start(); }
Example #19
Source File: MyPlayRecordActivity.java From letv with Apache License 2.0 | 6 votes |
private void initNavigationBar() { RelativeLayout my_playrecrod_content = (RelativeLayout) findViewById(R.id.my_collect_content); LayoutParams params = (LayoutParams) my_playrecrod_content.getLayoutParams(); params.bottomMargin = 0; my_playrecrod_content.setLayoutParams(params); this.mBackImageView = (ImageView) findViewById(2131362351); this.mEditView = (TextView) findViewById(2131362354); this.mEditView.setText(2131099788); this.mEditView.setTextColor(this.mContext.getResources().getColor(2131493261)); this.mTitleView = (TextView) findViewById(2131362352); this.mLoginTip = (RelativeLayout) findViewById(R.id.my_collect_bottom_login_btn); this.mLoginTip.setVisibility(8); this.mTitleView.setText(getResources().getString(2131100479)); this.mBackImageView.setOnClickListener(this.onClickEvent); this.mTitleView.setOnClickListener(this.onClickEvent); this.mEditView.setOnClickListener(this.onClickEvent); }
Example #20
Source File: ProgressBarDeterminate.java From MaterialDesignLibrary with Apache License 2.0 | 6 votes |
public void setProgress(int progress){ if(getWidth() == 0){ pendindProgress = progress; }else{ this.progress = progress; if(progress > max) progress = max; if(progress < min) progress = min; int totalWidth = max-min; double progressPercent = (double)progress/(double)totalWidth; int progressWidth =(int) (getWidth()*progressPercent); LayoutParams params = (LayoutParams) progressView.getLayoutParams(); params.width = progressWidth; params.height = getHeight(); progressView.setLayoutParams(params); pendindProgress = -1; } }
Example #21
Source File: PopupManager.java From memory-game with Apache License 2.0 | 6 votes |
public static void showPopupWon(GameState gameState) { RelativeLayout popupContainer = (RelativeLayout) Shared.activity.findViewById(R.id.popup_container); popupContainer.removeAllViews(); // popup PopupWonView popupWonView = new PopupWonView(Shared.context); popupWonView.setGameState(gameState); int width = Shared.context.getResources().getDimensionPixelSize(R.dimen.popup_won_width); int height = Shared.context.getResources().getDimensionPixelSize(R.dimen.popup_won_height); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height); params.addRule(RelativeLayout.CENTER_IN_PARENT); popupContainer.addView(popupWonView, params); // animate all together ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(popupWonView, "scaleX", 0f, 1f); ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(popupWonView, "scaleY", 0f, 1f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(scaleXAnimator, scaleYAnimator); animatorSet.setDuration(500); animatorSet.setInterpolator(new DecelerateInterpolator(2)); popupWonView.setLayerType(View.LAYER_TYPE_HARDWARE, null); animatorSet.start(); }
Example #22
Source File: PlayerActivity.java From BuildingForAndroidTV with MIT License | 5 votes |
private void setupController() { int w = (int) (mMetrics.widthPixels * MEDIA_BAR_WIDTH); int h = (int) (mMetrics.heightPixels * MEDIA_BAR_HEIGHT); int marginLeft = (int) (mMetrics.widthPixels * MEDIA_BAR_LEFT_MARGIN); int marginTop = (int) (mMetrics.heightPixels * MEDIA_BAR_TOP_MARGIN); int marginRight = (int) (mMetrics.widthPixels * MEDIA_BAR_RIGHT_MARGIN); int marginBottom = (int) (mMetrics.heightPixels * MEDIA_BAR_BOTTOM_MARGIN); LayoutParams lp = new LayoutParams(w, h); lp.setMargins(marginLeft, marginTop, marginRight, marginBottom); mControllers.setLayoutParams(lp); mStartText.setText(getResources().getString(R.string.init_text)); mEndText.setText(getResources().getString(R.string.init_text)); }
Example #23
Source File: TitleBar.java From letv with Apache License 2.0 | 5 votes |
public TitleBar(Context context) { super(context); WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); this.density = displayMetrics.density; setLayoutParams(new LayoutParams(-1, dip2px(TITLEBAR_HEIGHT))); setBackgroundDrawable(a.a(SOURCE_TITLEBAR, context)); initBackLayout(); initShareBtn(); }
Example #24
Source File: TitleBar.java From letv with Apache License 2.0 | 5 votes |
private void initBackBtn() { this.backBtn = new ImageView(getContext()); RelativeLayout.LayoutParams layoutParams = new LayoutParams(dip2px(BACK_BTN_WIDTH), dip2px(BACK_BTN_HEIGHT)); layoutParams.addRule(15); layoutParams.leftMargin = dip2px(20.0f); this.backBtn.setId(10000); this.backBtn.setLayoutParams(layoutParams); this.backBtn.setClickable(true); this.backBtn.setBackgroundDrawable(a.a(SOURCE_BACK_BTN, getContext())); this.backBtn.setPadding(dip2px(BACK_PADDING_LEFT), dip2px(7.0f), dip2px(20.0f), dip2px(7.0f)); this.backLayout.addView(this.backBtn); }
Example #25
Source File: PopupManager.java From AndroidAnimationExercise with Apache License 2.0 | 5 votes |
public static void showPopupSettings() { RelativeLayout popupContainer = (RelativeLayout) Shared.activity.findViewById(R.id.popup_container); popupContainer.removeAllViews(); // background ImageView imageView = new ImageView(Shared.context); imageView.setBackgroundColor(Color.parseColor("#88555555")); imageView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); imageView.setClickable(true); popupContainer.addView(imageView); // popup PopupSettingsView popupSettingsView = new PopupSettingsView(Shared.context); int width = Shared.context.getResources().getDimensionPixelSize(R.dimen.popup_settings_width); int height = Shared.context.getResources().getDimensionPixelSize(R.dimen.popup_settings_height); LayoutParams params = new LayoutParams(width, height); params.addRule(RelativeLayout.CENTER_IN_PARENT); popupContainer.addView(popupSettingsView, params); // animate all together ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(popupSettingsView, "scaleX", 0f, 1f); ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(popupSettingsView, "scaleY", 0f, 1f); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(scaleXAnimator, scaleYAnimator, alphaAnimator); animatorSet.setDuration(500); animatorSet.setInterpolator(new DecelerateInterpolator(2)); animatorSet.start(); }
Example #26
Source File: PopupManager.java From memory-game with Apache License 2.0 | 5 votes |
public static void showPopupSettings() { RelativeLayout popupContainer = (RelativeLayout) Shared.activity.findViewById(R.id.popup_container); popupContainer.removeAllViews(); // background ImageView imageView = new ImageView(Shared.context); imageView.setBackgroundColor(Color.parseColor("#88555555")); imageView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); imageView.setClickable(true); popupContainer.addView(imageView); // popup PopupSettingsView popupSettingsView = new PopupSettingsView(Shared.context); int width = Shared.context.getResources().getDimensionPixelSize(R.dimen.popup_settings_width); int height = Shared.context.getResources().getDimensionPixelSize(R.dimen.popup_settings_height); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height); params.addRule(RelativeLayout.CENTER_IN_PARENT); popupContainer.addView(popupSettingsView, params); // animate all together ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(popupSettingsView, "scaleX", 0f, 1f); ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(popupSettingsView, "scaleY", 0f, 1f); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(scaleXAnimator, scaleYAnimator, alphaAnimator); animatorSet.setDuration(500); animatorSet.setInterpolator(new DecelerateInterpolator(2)); animatorSet.start(); }
Example #27
Source File: TagViewRight.java From school_shop with MIT License | 5 votes |
private void init(boolean isMove){ RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(position.getXplace(), position.getYplace(), 0, 0); this.setLayoutParams(lp); textView = (TextView)findViewById(R.id.text); textView.setText(tagInfo.getTitle()); rLayout = this; this.setClickable(true); icon_brandimg = (ImageView) findViewById(R.id.icon_brand); blackIconimg1 = (ImageView) findViewById(R.id.blackIcon1); blackIconimg2 = (ImageView) findViewById(R.id.blackIcon2); if(isMove) initMove(); }
Example #28
Source File: GdvAdapter.java From palmsuda with Apache License 2.0 | 5 votes |
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = new ViewHolder(); convertView = this.mInflater.inflate(R.layout.grid_icon_item, null); holder.tvItem = (TextView) convertView.findViewById(R.id.wap_item_name); holder.iView = (ImageView) convertView .findViewById(R.id.wap_item_image); holder.icView = (ImageView) convertView.findViewById(R.id.wap_ic_image); ModuleItem item = this.getItem(position); holder.tvItem.setText("" + item.getModuleName()); if (item.getOptions().isHotModule()) { holder.icView.setVisibility(View.VISIBLE); holder.icView.setImageResource(R.drawable.icon_hot); } else if (item.getOptions().isNewModule()) { holder.icView.setVisibility(View.VISIBLE); holder.icView.setImageResource(R.drawable.icon_new); } else { holder.icView.setVisibility(View.GONE); holder.icView.setImageResource(0); } RelativeLayout.LayoutParams paLayoutParams = (LayoutParams) holder.iView .getLayoutParams(); paLayoutParams.width = PalmSudaApp.SCREEN_WEIDTH * 3 / 16; paLayoutParams.height = paLayoutParams.width * 100 / 96; holder.iView.setLayoutParams(paLayoutParams); holder.iView.setScaleType(ScaleType.FIT_XY); imgeWorker.loadBitmap(item.getIconUrl(), holder.iView, PalmSudaApp.SCREEN_WEIDTH / 4, PalmSudaApp.SCREEN_WEIDTH / 4); GridView.LayoutParams lparams = new GridView.LayoutParams( PalmSudaApp.SCREEN_WEIDTH * 3 / 16 + 5, PalmSudaApp.SCREEN_WEIDTH / 4 + 10); convertView.setLayoutParams(lparams); return convertView; }
Example #29
Source File: IRegionDisplay.java From CameraV with GNU General Public License v3.0 | 5 votes |
public void update(int displayLeft, int displayTop) { Log.d(LOG, "new bounds left: " + displayLeft + " and top: " + displayTop); lp = (LayoutParams) getLayoutParams(); lp.leftMargin = displayLeft; lp.topMargin = displayTop; setLayoutParams(lp); setImageDrawable(d); }
Example #30
Source File: LivePlayerView.java From letv with Apache License 2.0 | 5 votes |
private void initVideoView() { if (this.mVideoView == null) { this.mVideoView = new LiveVideoView(this.mContext); this.mVideoView.setStatisticsHelper(this.mStatisticsHelper); LayoutParams params = new LayoutParams(-1, -1); params.addRule(13); addView(this.mVideoView, params); } }