当前位置: 首页>>代码示例>>Java>>正文


Java LayoutParams.addRule方法代码示例

本文整理汇总了Java中android.widget.RelativeLayout.LayoutParams.addRule方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams.addRule方法的具体用法?Java LayoutParams.addRule怎么用?Java LayoutParams.addRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.RelativeLayout.LayoutParams的用法示例。


在下文中一共展示了LayoutParams.addRule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			
			RelativeLayout layoutView = new RelativeLayout(context);
			TextView textView = new TextView(context);
			textView.setTextSize(13);
			textView.setText(itemList.get(position));
			
			textView.setTag(position);
			
			if (checkedPosition == position || itemList.size() == 1) {
//				layoutView.setBackgroundColor(0x8033B5E5);
				textView.setTextColor(context.getResources().getColor(R.color.rb_text_check));
			} else {
				textView.setTextColor(Color.WHITE);
			}
			
			LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			params.addRule(RelativeLayout.CENTER_IN_PARENT);
			layoutView.addView(textView, params);
			layoutView.setMinimumHeight(ParamsUtil.dpToPx(context, 26));
			return layoutView;

		}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:25,代码来源:PopMenu.java

示例2: moveButton

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
/**
 * Toggles button location on click between top-left and bottom-right
 */
private void moveButton() {
    LayoutParams params = (LayoutParams) mButton.getLayoutParams();
    if (mTopLeft) {
        params.removeRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params.removeRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    } else {
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    }
    mButton.setLayoutParams(params);
    mTopLeft = !mTopLeft;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:20,代码来源:CurvedMotion.java

示例3: getPageView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private RelativeLayout getPageView() {
    this.rlPage = new RelativeLayout(getContext());
    this.rlPage.setBackgroundDrawable(this.background);
    if (this.dialogMode) {
        RelativeLayout rlDialog = new RelativeLayout(getContext());
        rlDialog.setBackgroundColor(-1070452174);
        int dp_8 = R.dipToPx(getContext(), 8);
        LayoutParams lpDialog = new LayoutParams(R.getScreenWidth(getContext()) - (dp_8 * 2), -2);
        lpDialog.topMargin = dp_8;
        lpDialog.bottomMargin = dp_8;
        lpDialog.addRule(13);
        rlDialog.setLayoutParams(lpDialog);
        this.rlPage.addView(rlDialog);
        rlDialog.addView(getPageTitle());
        rlDialog.addView(getPageBody());
        rlDialog.addView(getImagePin());
    } else {
        this.rlPage.addView(getPageTitle());
        this.rlPage.addView(getPageBody());
        this.rlPage.addView(getImagePin());
    }
    return this.rlPage;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:EditPage.java

示例4: getPageTitle

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private TitleLayout getPageTitle() {
    this.llTitle = new TitleLayout(getContext());
    this.llTitle.setId(1);
    this.llTitle.getBtnBack().setOnClickListener(this);
    int resId = R.getStringRes(this.activity, "multi_share");
    if (resId > 0) {
        this.llTitle.getTvTitle().setText(resId);
    }
    this.llTitle.getBtnRight().setVisibility(0);
    resId = R.getStringRes(this.activity, "share");
    if (resId > 0) {
        this.llTitle.getBtnRight().setText(resId);
    }
    this.llTitle.getBtnRight().setOnClickListener(this);
    LayoutParams lp = new LayoutParams(-2, -2);
    lp.addRule(9);
    lp.addRule(10);
    lp.addRule(11);
    this.llTitle.setLayoutParams(lp);
    return this.llTitle;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:EditPage.java

示例5: getPageBody

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private LinearLayout getPageBody() {
    this.llBody = new LinearLayout(getContext());
    this.llBody.setId(2);
    int resId = R.getBitmapRes(this.activity, "edittext_back");
    if (resId > 0) {
        this.llBody.setBackgroundResource(resId);
    }
    this.llBody.setOrientation(1);
    LayoutParams lpBody = new LayoutParams(-2, -2);
    lpBody.addRule(5, this.llTitle.getId());
    lpBody.addRule(3, this.llTitle.getId());
    lpBody.addRule(7, this.llTitle.getId());
    if (!this.dialogMode) {
        lpBody.addRule(12);
    }
    int dp_3 = R.dipToPx(getContext(), 3);
    lpBody.setMargins(dp_3, dp_3, dp_3, dp_3);
    this.llBody.setLayoutParams(lpBody);
    this.llBody.addView(getMainBody());
    this.llBody.addView(getSep());
    this.llBody.addView(getPlatformList());
    return this.llBody;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:EditPage.java

示例6: onCreateDialogView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
@Override
protected View onCreateDialogView() {

    RelativeLayout relativeLayout = new RelativeLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layoutParams.addRule(RelativeLayout.BELOW, 2);


    LayoutParams layoutParamsText = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParamsText.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    layoutParamsText.addRule(RelativeLayout.CENTER_HORIZONTAL);

    colorPickerView = new ColorPicker(getContext());
    colorPickerView.setId(1);

    currentColor = new TextView(getContext());
    currentColor.setTextSize(16);
    currentColor.setId(2);

    relativeLayout.addView(colorPickerView, layoutParams);
    relativeLayout.addView(currentColor, layoutParamsText);

    return relativeLayout;

}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:27,代码来源:ColorPickerPreference.java

示例7: onCreateView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	activity = getActivity();
	context = activity.getApplicationContext();
	receiver = new UploadReceiver();
	activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_UPLOAD));
	service = new Intent(context, UploadService.class);
	
	binderService();
	
	RelativeLayout view = new RelativeLayout(context);
	view.setBackgroundColor(Color.WHITE);
	LayoutParams uploadLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	uploadListView = new ListView(context);
	uploadListView.setDivider(getResources().getDrawable(R.drawable.line));
	view.addView(uploadListView, uploadLayoutParams);

	uploadListView.setOnItemClickListener(onItemClickListener);
	uploadListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
	
	initUploadList();
	
	LayoutParams uploadButtonLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	uploadButtonLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	uploadButtonLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
	
	uploadButton = new Button(context);
	view.addView(uploadButton, uploadButtonLayoutParams);
	uploadButton.setText("上传");
	uploadButton.setTextColor(0xFFFFFFFF);
	uploadButton.setOnClickListener(uploadOnClickListener);
	
	timer.schedule(timerTask, 0, 1000);
	return view;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:36,代码来源:UploadFragment.java

示例8: getItemView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private View getItemView(Pair<String, String> pair){
	RelativeLayout accountView = new RelativeLayout(context);
	TextView textView = new TextView(context);
	textView.setText(pair.first + " : " + pair.second);
	textView.setTextSize(16);
	textView.setPadding(10, 30, 0, 0);
	textView.setMinHeight(ParamsUtil.dpToPx(context, 48));
	LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	
	accountView.addView(textView, params);
	return accountView;
	
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:15,代码来源:AccountViewAdapter.java

示例9: resizeAdView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
public static void resizeAdView(Activity activity, WindowManager wm, final ImageView iv, int adWidth, int adHeight) {
	if (adWidth == 0 || adHeight == 0) {
		return;
	}
	int screenWidth = wm.getDefaultDisplay().getWidth();
	int screenHeight = wm.getDefaultDisplay().getHeight();

	if (PlayerUtil.isPortrait()) {
		screenHeight = screenHeight * 2 / 5;
	} else {
		// 全屏下,广告素材为屏幕60%
		screenWidth = screenWidth * 6 / 10;
		screenHeight = screenHeight * 6 / 10;
	}

	// 等比缩放比例计算
	float widthRatio = (float) screenWidth / (float) adWidth;
	float heightRatio = (float) screenHeight / (float) adHeight;

	if (widthRatio > heightRatio) {
		screenWidth = (int) ((float) adWidth * heightRatio);
	} else {
		screenHeight = (int) ((float) adHeight * widthRatio);
	}
	
	final LayoutParams ivAdLayoutParams = new LayoutParams(screenWidth,
			screenHeight);
	ivAdLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

	activity.runOnUiThread(new Runnable() {

		@Override
		public void run() {
			iv.setLayoutParams(ivAdLayoutParams);
		}
	});
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:38,代码来源:PlayerUtil.java

示例10: initWithNonCopyright

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
public void initWithNonCopyright() {
    this.mIsNonCopyright = true;
    r4 = new int[2][];
    r4[0] = new int[]{16842919};
    r4[1] = new int[0];
    ColorStateList color = new ColorStateList(r4, new int[]{-1, this.mContext.getResources().getColor(R.color.letv_color_noncopyright)});
    int bg = R.drawable.noncopyright_btn_selector;
    this.request_error_btn.setTextColor(color);
    this.complaint_success_button.setTextColor(color);
    this.vip_not_login_error_btn.setTextColor(color);
    this.vip_login_error_btn.setTextColor(color);
    this.jump_error_btn.setTextColor(color);
    this.demand_error_btn.setTextColor(color);
    this.cannot_play_btn.setTextColor(color);
    this.mTxtSubmitInfo.setTextColor(color);
    this.ip_error_call_text.setTextColor(color);
    this.request_error_btn.setBackgroundResource(bg);
    this.complaint_success_button.setBackgroundResource(bg);
    this.vip_not_login_error_btn.setBackgroundResource(bg);
    this.vip_login_error_btn.setBackgroundResource(bg);
    this.jump_error_btn.setBackgroundResource(bg);
    this.demand_error_btn.setBackgroundResource(bg);
    this.cannot_play_btn.setBackgroundResource(bg);
    this.ip_error_call_text.setBackgroundResource(bg);
    int visibile = this.loading.getVisibility();
    findViewById(R.id.loading).setVisibility(8);
    this.loading = findViewById(R.id.noncopyright_loading);
    this.loading.setVisibility(visibile);
    LayoutParams lp = (LayoutParams) this.loadingTxt.getLayoutParams();
    lp.addRule(3, R.id.noncopyright_loading);
    this.loadingTxt.setLayoutParams(lp);
    this.mTxtSubmitInfo.setVisibility(8);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:34,代码来源:PlayLoadLayout.java

示例11: initVideoView

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:10,代码来源:LivePlayerView.java

示例12: getImagePin

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private ImageView getImagePin() {
    this.ivPin = new ImageView(getContext());
    int resId = R.getBitmapRes(this.activity, "pin");
    if (resId > 0) {
        this.ivPin.setImageResource(resId);
    }
    LayoutParams lp = new LayoutParams(R.dipToPx(getContext(), 80), R.dipToPx(getContext(), 36));
    lp.topMargin = R.dipToPx(getContext(), 6);
    lp.addRule(6, this.llBody.getId());
    lp.addRule(11);
    this.ivPin.setLayoutParams(lp);
    this.ivPin.setVisibility(8);
    return this.ivPin;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:EditPage.java

示例13: setSurfaceSize

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private void setSurfaceSize() {
	DisplayMetrics metrics = new DisplayMetrics();
	getWindowManager().getDefaultDisplay().getMetrics(metrics);
	int width = metrics.widthPixels;
	int height = (int) (width * PREVIEW_WIDTH / (float) PREVIEW_HEIGHT);
	LayoutParams params = new LayoutParams(width, height);
	params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
	mPreviewSurface.setLayoutParams(params);
	mFaceSurface.setLayoutParams(params);
}
 
开发者ID:HuaDanJson,项目名称:FaceAI_Android,代码行数:11,代码来源:VideoRecognise.java

示例14: setSurfaceViewLayout

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
private void setSurfaceViewLayout() {
	LayoutParams params = getScreenSizeParams(currentScreenSizeFlag);
	params.addRule(RelativeLayout.CENTER_IN_PARENT);
	surfaceView.setLayoutParams(params);
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:6,代码来源:ADMediaPlayActivity.java

示例15: ColorPickerDialog

import android.widget.RelativeLayout.LayoutParams; //导入方法依赖的package包/类
public ColorPickerDialog(Context context, int initialColor, OnColorSelectedListener onColorSelectedListener) {
    super(context);

    this.onColorSelectedListener = onColorSelectedListener;

    RelativeLayout relativeLayout = new RelativeLayout(context);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    colorPickerView = new ColorPicker(context);
    colorPickerView.setColor(initialColor);

    relativeLayout.addView(colorPickerView, layoutParams);

    setButton(BUTTON_POSITIVE, context.getString(android.R.string.ok), onClickListener);
    setButton(BUTTON_NEGATIVE, context.getString(android.R.string.cancel), onClickListener);

    setView(relativeLayout);

}
 
开发者ID:MLNO,项目名称:airgram,代码行数:21,代码来源:ColorPickerDialog.java


注:本文中的android.widget.RelativeLayout.LayoutParams.addRule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。