當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。