类android.widget.RelativeLayout.LayoutParams源码实例Demo

下面列出了怎么用android.widget.RelativeLayout.LayoutParams的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FimiX8-RE   文件: CustomVideoView.java
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);
}
 
源代码2 项目: KJFrameForAndroid   文件: Splash.java
/**
 * 屏幕适配
 */
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);
}
 
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;
        }
    });
}
 
源代码4 项目: mobile-manager-tool   文件: ViewUtils.java
/**
 * 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;
}
 
源代码5 项目: relight   文件: BaseAndroidWidget.java
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);
}
 
源代码6 项目: MoeGallery   文件: ProgressBarDeterminate.java
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;
	}
}
 
源代码7 项目: letv   文件: MyPlayRecordFragment.java
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);
    }
}
 
源代码8 项目: CuXtomCam   文件: CuxtomCamActivity.java
/**
 * 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);
}
 
源代码9 项目: panoramagl   文件: PLManager.java
/**
 * 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);
}
 
源代码10 项目: memory-game   文件: PopupManager.java
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();
}
 
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;
	}
}
 
源代码12 项目: letv   文件: MyPlayRecordActivity.java
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);
}
 
源代码13 项目: AndroidAnimationExercise   文件: PopupManager.java
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();
}
 
源代码14 项目: letv   文件: LiveFragment.java
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);
}
 
源代码15 项目: CameraV   文件: IRegionDisplay.java
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);
}
 
源代码16 项目: MultiImageChooser   文件: ImageDetailsActivity.java
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);
}
 
源代码17 项目: AndroidStudyDemo   文件: ViewUtil.java
/**
 * 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;
}
 
源代码18 项目: sctalk   文件: MessageActivity.java
@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;
    }
}
 
源代码19 项目: letv   文件: PKDialog.java
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);
}
 
源代码20 项目: panoramagl   文件: PLView.java
/**
 * 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);
}
 
@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();
        }
    });
}
 
源代码22 项目: FimiX8-RE   文件: BodyRecycleViewHolder.java
private void initImageViewParams(Context context, View parentView, View view) {
    parentView.measure(0, 0);
    int currentHeight = parentView.getMeasuredHeight();
    LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
    layoutParams.addRule(11);
    layoutParams.rightMargin = SizeTool.pixToDp(12.0f, context);
    layoutParams.topMargin = currentHeight - SizeTool.pixToDp(25.0f, context);
    view.setLayoutParams(layoutParams);
}
 
源代码23 项目: FimiX8-RE   文件: BodyRecycleViewHolder.java
private void initTextViewParams(Context context, View parentView, View view) {
    parentView.measure(0, 0);
    int currentHeight = parentView.getMeasuredHeight();
    LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
    layoutParams.leftMargin = SizeTool.pixToDp(10.0f, context);
    layoutParams.topMargin = currentHeight - SizeTool.pixToDp(24.0f, context);
    view.setLayoutParams(layoutParams);
}
 
源代码24 项目: FimiX8-RE   文件: BodyRecycleViewHolder.java
private void initSimpleDraweeViewParams(Context context, View view) {
    DisplayMetrics mDisplayMetrics = context.getResources().getDisplayMetrics();
    LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
    int screenWidth = mDisplayMetrics.widthPixels;
    int scteenHeight = mDisplayMetrics.heightPixels;
    if (screenWidth < scteenHeight) {
        screenWidth = scteenHeight;
    }
    layoutParams.width = ((screenWidth - (SizeTool.pixToDp(2.5f, context) * 3)) - (SizeTool.pixToDp(8.0f, context) * 2)) / 4;
    layoutParams.height = (layoutParams.width * 9) / 16;
    view.setLayoutParams(layoutParams);
}
 
源代码25 项目: FimiX8-RE   文件: BodyRecycleViewHolder.java
private void initImageViewParams(Context context, View parentView, View view) {
    parentView.measure(0, 0);
    int currentHeight = parentView.getMeasuredHeight();
    LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
    layoutParams.addRule(11);
    layoutParams.rightMargin = SizeTool.pixToDp(12.0f, context);
    layoutParams.topMargin = currentHeight - SizeTool.pixToDp(25.0f, context);
    view.setLayoutParams(layoutParams);
}
 
源代码26 项目: AndroidDemoProjects   文件: PlayerActivity.java
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));
    }
 
源代码27 项目: FimiX8-RE   文件: X8HorizontalTrimView.java
public X8HorizontalTrimView(final Context context, AttributeSet attrs) {
    super(context, attrs);
    View view = LayoutInflater.from(context).inflate(R.layout.x8_gimbal_horizontal_trim_layout, null);
    this.root_layout = (PercentRelativeLayout) view.findViewById(R.id.root_layout);
    addView(view, new LayoutParams(-1, -1));
    this.seekBar = (X8DoubleWaySeekBar) view.findViewById(R.id.seek_bar);
    this.tvBubbleTop = (TextView) view.findViewById(R.id.tv_bubble_top);
    view.findViewById(R.id.btn_sure).setOnClickListener(this);
    this.btnReduce = (ImageButton) view.findViewById(R.id.btn_gimbal_reduce_left);
    this.btnAdd = (ImageButton) view.findViewById(R.id.btn_gimbal_add_right);
    this.btnReduce.setOnClickListener(this);
    this.btnAdd.setOnClickListener(this);
    this.seekBar.setOnSeekProgressListener(new OnSeekProgressListener() {
        @SuppressLint({"StringFormatMatches"})
        public void onSeekProgress(int progress) {
            X8HorizontalTrimView.this.currValue = progress;
            if (progress <= 0) {
                X8HorizontalTrimView.this.tvBubbleTop.setText(String.valueOf(String.format(context.getString(R.string.x8_cloud_minus_angle), new Object[]{Float.valueOf(((float) progress) / 10.0f)})));
                return;
            }
            X8HorizontalTrimView.this.tvBubbleTop.setText(String.valueOf(String.format(context.getString(R.string.x8_cloud_angle), new Object[]{Float.valueOf(((float) progress) / 10.0f)})));
        }

        public void onPointerPositionChanged(int x, int y) {
            X8HorizontalTrimView.this.tvBubbleTop.setX((float) (x - (X8HorizontalTrimView.this.tvBubbleTop.getWidth() / 2)));
        }

        public void onSizeChanged() {
            X8HorizontalTrimView.this.seekBar.setProgress((float) X8HorizontalTrimView.this.currValue);
            X8HorizontalTrimView.this.isReady = true;
        }
    });
}
 
源代码28 项目: RePlugin-GameSdk   文件: FunRegistActivity.java
@Override
protected void onPreExecute() {
	super.onPreExecute();
	registProgressBar = new ProgressBar(FunRegistActivity.this, null,
			android.R.attr.progressBarStyle);
	registProgressBar.setVisibility(View.VISIBLE);

	LayoutParams progressBarParams = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	progressBarParams.addRule(RelativeLayout.CENTER_IN_PARENT);
	registRelativeLayout.addView(registProgressBar, progressBarParams);
}
 
源代码29 项目: RePlugin-GameSdk   文件: FunLoginActivity.java
@Override
protected void onPreExecute() {
	super.onPreExecute();
	loginProgressBar = new ProgressBar(FunLoginActivity.this, null,
			android.R.attr.progressBarStyle);
	loginProgressBar.setVisibility(View.VISIBLE);

	LayoutParams progressBarParams = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	progressBarParams.addRule(RelativeLayout.CENTER_IN_PARENT);
	loginRelativeLayout.addView(loginProgressBar, progressBarParams);
}
 
源代码30 项目: zidoorecorder   文件: PipService.java
/**
 * 隐藏控制器
 */
private void hideController()
{
	mRlController.setVisibility(View.GONE);
	WindowManager.LayoutParams params = (WindowManager.LayoutParams) mVPip.getLayoutParams();
	params.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
	((WindowManager) getSystemService(WINDOW_SERVICE)).updateViewLayout(mVPip, params);
}
 
 类所在包
 同包方法