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


Java LayoutParams.MATCH_PARENT屬性代碼示例

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


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

示例1: getAccessoryView

private static ImageView getAccessoryView(ATableViewCell cell, ATableViewCellAccessoryType accessoryType) {
    LinearLayout containerView = (LinearLayout) cell.findViewById(R.id.containerView);

    // check if accessoryView already exists for current cell before creating a new instance.
    ImageView accessoryView = (ImageView) containerView.findViewById(R.id.accessoryView);
    if (accessoryView == null) {
        Resources res = cell.getResources();

        // get marginRight for accessoryView, DisclosureButton has a different one.
        LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
        int marginRight = (int) res.getDimension(R.dimen.atv_cell_content_margin);
        if (accessoryType == ATableViewCellAccessoryType.DisclosureButton) {
            marginRight = (int) res.getDimension(R.dimen.atv_cell_disclosure_button_margin_right);
        }
        params.setMargins(0, 0, marginRight, 0);

        // setup.
        accessoryView = new ATableViewCellAccessoryView(cell.getContext());
        accessoryView.setId(R.id.accessoryView);
        accessoryView.setLayoutParams(params);

        containerView.addView(accessoryView);
    }

    return accessoryView;
}
 
開發者ID:hh-in-zhuzhou,項目名稱:ShangHanLun,代碼行數:26,代碼來源:ATableViewCellAccessoryView.java

示例2: onCreate

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    callId = intent.getStringExtra("callId");
    LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setPadding(20, 20, 20, 20);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    editText = new EditText(this);
    editText.setHint(R.string.demo_b_username_hint);
    editText.setText("billy");
    layout.addView(editText, params);
    Button button = new Button(this);
    button.setText(R.string.demo_b_click_login);
    button.setOnClickListener(this);
    layout.addView(button, params);
    setContentView(layout);
}
 
開發者ID:luckybilly,項目名稱:CC,代碼行數:19,代碼來源:LoginActivity.java

示例3: getMainBody

private LinearLayout getMainBody() {
	LinearLayout llMainBody = new LinearLayout(getContext());
	llMainBody.setOrientation(LinearLayout.VERTICAL);
	LayoutParams lpMain = new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	lpMain.weight = 1;
	int dp_4 = dipToPx(getContext(), 4);
	lpMain.setMargins(dp_4, dp_4, dp_4, dp_4);
	llMainBody.setLayoutParams(lpMain);

	LinearLayout llContent = new LinearLayout(getContext());
	LayoutParams lpContent = new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	lpContent.weight = 1;
	llMainBody.addView(llContent, lpContent);

	// share content editor
	etContent = new EditText(getContext());
	etContent.setGravity(Gravity.LEFT | Gravity.TOP);
	etContent.setBackgroundDrawable(null);
	etContent.setText(String.valueOf(shareParamMap.get("text")));
	etContent.addTextChangedListener(this);
	LayoutParams lpEt = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpEt.weight = 1;
	etContent.setLayoutParams(lpEt);
	llContent.addView(etContent);

	llContent.addView(getThumbView());
	llMainBody.addView(getBodyBottom());

	return llMainBody;
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:33,代碼來源:EditPage.java

示例4: getSep

private View getSep() {
	View vSep = new View(getContext());
	vSep.setBackgroundColor(0xff000000);
	int dp_1 = dipToPx(getContext(), 1);
	LayoutParams lpSep = new LayoutParams(
			LayoutParams.MATCH_PARENT, dp_1);
	vSep.setLayoutParams(lpSep);
	return vSep;
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:9,代碼來源:EditPage.java

示例5: getPlatformList

private LinearLayout getPlatformList() {
	LinearLayout llToolBar = new LinearLayout(getContext());
	LayoutParams lpTb = new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llToolBar.setLayoutParams(lpTb);

	TextView tvShareTo = new TextView(getContext());
	int resId = getStringRes(activity, "share_to");
	if (resId > 0) {
		tvShareTo.setText(resId);
	}
	tvShareTo.setTextColor(0xffcfcfcf);
	tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	int dp_9 = dipToPx(getContext(), 9);
	LayoutParams lpShareTo = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpShareTo.gravity = Gravity.CENTER_VERTICAL;
	lpShareTo.setMargins(dp_9, 0, 0, 0);
	tvShareTo.setLayoutParams(lpShareTo);
	llToolBar.addView(tvShareTo);

	HorizontalScrollView sv = new HorizontalScrollView(getContext());
	sv.setHorizontalScrollBarEnabled(false);
	sv.setHorizontalFadingEdgeEnabled(false);
	LayoutParams lpSv = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
	sv.setLayoutParams(lpSv);
	llToolBar.addView(sv);

	llPlat = new LinearLayout(getContext());
	llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	sv.addView(llPlat);

	return llToolBar;
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:37,代碼來源:EditPage.java

示例6: init

public void init(D dialog) {
	llBody = new LinearLayout(dialog.getContext());
	llBody.setBackgroundColor(0xffffffff);
	llBody.setOrientation(LinearLayout.VERTICAL);
	LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	dialog.setContentView(llBody, lp);
	initBodyView(llBody);
	initAnimations();
}
 
開發者ID:MobClub,項目名稱:BBSSDK-for-Android,代碼行數:9,代碼來源:ScrollUpAndDownDialogAdapter.java

示例7: getMainBody

private LinearLayout getMainBody() {
	LinearLayout llMainBody = new LinearLayout(getContext());
	llMainBody.setOrientation(LinearLayout.VERTICAL);
	LinearLayout.LayoutParams lpMain = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	lpMain.weight = 1;
	int dp_4 = dipToPx(getContext(), 4);
	lpMain.setMargins(dp_4, dp_4, dp_4, dp_4);
	llMainBody.setLayoutParams(lpMain);

	LinearLayout llContent = new LinearLayout(getContext());
	LinearLayout.LayoutParams lpContent = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	lpContent.weight = 1;
	llMainBody.addView(llContent, lpContent);

	// 文字輸入區域
	etContent = new EditText(getContext());
	etContent.setGravity(Gravity.LEFT | Gravity.TOP);
	etContent.setBackgroundDrawable(null);
	etContent.setText(String.valueOf(reqData.get("text")));
	etContent.addTextChangedListener(this);
	LinearLayout.LayoutParams lpEt = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpEt.weight = 1;
	etContent.setLayoutParams(lpEt);
	llContent.addView(etContent);

	llContent.addView(getThumbView());
	llMainBody.addView(getBodyBottom());

	return llMainBody;
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:33,代碼來源:EditPage.java

示例8: getSep

private View getSep() {
	View vSep = new View(getContext());
	vSep.setBackgroundColor(0xff000000);
	int dp_1 = dipToPx(getContext(), 1);
	LinearLayout.LayoutParams lpSep = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, dp_1);
	vSep.setLayoutParams(lpSep);
	return vSep;
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:9,代碼來源:EditPage.java

示例9: getPlatformList

private LinearLayout getPlatformList() {
	LinearLayout llToolBar = new LinearLayout(getContext());
	LinearLayout.LayoutParams lpTb = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llToolBar.setLayoutParams(lpTb);

	TextView tvShareTo = new TextView(getContext());
	int resId = getStringRes(activity, "share_to");
	if (resId > 0) {
		tvShareTo.setText(resId);
	}
	tvShareTo.setTextColor(0xffcfcfcf);
	tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	int dp_9 = dipToPx(getContext(), 9);
	LinearLayout.LayoutParams lpShareTo = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpShareTo.gravity = Gravity.CENTER_VERTICAL;
	lpShareTo.setMargins(dp_9, 0, 0, 0);
	tvShareTo.setLayoutParams(lpShareTo);
	llToolBar.addView(tvShareTo);

	HorizontalScrollView sv = new HorizontalScrollView(getContext());
	sv.setHorizontalScrollBarEnabled(false);
	sv.setHorizontalFadingEdgeEnabled(false);
	LinearLayout.LayoutParams lpSv = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
	sv.setLayoutParams(lpSv);
	llToolBar.addView(sv);

	llPlat = new LinearLayout(getContext());
	llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
	sv.addView(llPlat);

	return llToolBar;
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:37,代碼來源:EditPage.java

示例10: afterPlatformListGot

/** 顯示平台列表 */
public void afterPlatformListGot() {
	String name = String.valueOf(reqData.get("platform"));
	int size = platformList == null ? 0 : platformList.length;
	views = new View[size];

	final int dp_24 = dipToPx(getContext(), 24);
	LinearLayout.LayoutParams lpItem = new LinearLayout.LayoutParams(dp_24, dp_24);
	final int dp_9 = dipToPx(getContext(), 9);
	lpItem.setMargins(0, 0, dp_9, 0);
	FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	lpMask.gravity = Gravity.LEFT | Gravity.TOP;
	int selection = 0;
	for (int i = 0; i < size; i++) {
		FrameLayout fl = new FrameLayout(getContext());
		fl.setLayoutParams(lpItem);
		if (i >= size - 1) {
			fl.setLayoutParams(new LinearLayout.LayoutParams(dp_24, dp_24));
		}
		llPlat.addView(fl);
		fl.setOnClickListener(this);

		ImageView iv = new ImageView(getContext());
		iv.setScaleType(ScaleType.CENTER_INSIDE);
		iv.setImageBitmap(getPlatLogo(platformList[i]));
		iv.setLayoutParams(new FrameLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		fl.addView(iv);

		views[i] = new View(getContext());
		views[i].setBackgroundColor(0xcfffffff);
		views[i].setOnClickListener(this);
		if (name != null && name.equals(platformList[i].getName())) {
			views[i].setVisibility(View.INVISIBLE);
			selection = i;

			// 編輯分享內容的統計
			ShareSDK.logDemoEvent(3, platformList[i]);
		}
		views[i].setLayoutParams(lpMask);
		fl.addView(views[i]);
	}

	final int postSel = selection;
	UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
		public boolean handleMessage(Message msg) {
			HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
			hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
			return false;
		}
	});
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:53,代碼來源:EditPage.java

示例11: PRow

public PRow(Context c, LinearLayout cardLl, int n) {
    this.n = n;
    float t = 100f;
    float tt = t / n;

    ll = new LinearLayout(c);
    ll.setOrientation(LinearLayout.HORIZONTAL);
    ll.setWeightSum(t);
    cardLl.addView(ll);

    lParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, tt);
}
 
開發者ID:victordiaz,項目名稱:phonk,代碼行數:12,代碼來源:PRow.java

示例12: setContentViewLayoutParams

public void setContentViewLayoutParams(boolean isHeightMatchParent,
                                       boolean isWidthMatchParent) {
    LayoutParams lp = (LayoutParams) child.getLayoutParams();
    if (isHeightMatchParent) {
        lp.height = LayoutParams.MATCH_PARENT;
    }
    if (isWidthMatchParent) {
        lp.height = LayoutParams.MATCH_PARENT;
    }
    // 默認設置寬高為match_parent
    child.setLayoutParams(lp);
}
 
開發者ID:LonelyMushroom,項目名稱:aarLibrary,代碼行數:12,代碼來源:XRefreshContentView.java

示例13: showStandardCredits

private void showStandardCredits(StandardCredit standardCredit) {
    if (standardCredit != null) {
        String types[] = getContext().getResources().getStringArray(
                R.array.type_name);
        LinearLayout container = (LinearLayout) contentView
                .findViewById(R.id.container);
        container.removeAllViews();
        LinearLayout.LayoutParams params = new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        params.setMargins(10, 10, 10, 10);
        for (int i = 0; i < 8; i++) {
            TextView text = new TextView(getContext());
            text.setLayoutParams(params);
            text.setTextAppearance(getContext(),
                    android.R.style.TextAppearance_Medium);
            text.setTextColor(getContext().getResources().getColor(
                    R.color.darken));
            text.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
            if (i % 2 == 0) {
                text.setBackgroundResource(R.color.cloud);
            } else {
                text.setBackgroundResource(android.R.color.transparent);
            }
            text.setText(types[i] + ":"
                    + String.valueOf(standardCredit.getCredits().get(i)));
            container.addView(text);
        }
    }
}
 
開發者ID:kamisakihideyoshi,項目名稱:TaipeiTechRefined,代碼行數:29,代碼來源:CreditStandardDialog.java

示例14: onCreate

public void onCreate() {
	LinearLayout llPage = new LinearLayout(getContext());
	llPage.setBackgroundColor(0xfff5f5f5);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	// 標題欄
	llTitle = new TitleLayout(getContext());
	int resId = getBitmapRes(getContext(), "title_back");
	if (resId > 0) {
		llTitle.setBackgroundResource(resId);
	}
	llTitle.getBtnBack().setOnClickListener(this);
	resId = getStringRes(getContext(), "multi_share");
	if (resId > 0) {
		llTitle.getTvTitle().setText(resId);
	}
	llTitle.getBtnRight().setVisibility(View.VISIBLE);
	resId = getStringRes(getContext(), "finish");
	if (resId > 0) {
		llTitle.getBtnRight().setText(resId);
	}
	llTitle.getBtnRight().setOnClickListener(this);
	llTitle.setLayoutParams(new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	llPage.addView(llTitle);

	FrameLayout flPage = new FrameLayout(getContext());
	LayoutParams lpFl = new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	lpFl.weight = 1;
	flPage.setLayoutParams(lpFl);
	llPage.addView(flPage);

	// 關注(或朋友)列表
	PullToRefreshView followList = new PullToRefreshView(getContext());
	FrameLayout.LayoutParams lpLv = new FrameLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	followList.setLayoutParams(lpLv);
	flPage.addView(followList);
	adapter = new FollowAdapter(followList);
	adapter.setPlatform(platform);
	followList.setAdapter(adapter);
	adapter.getListView().setOnItemClickListener(this);

	ImageView ivShadow = new ImageView(getContext());
	resId = getBitmapRes(getContext(), "title_shadow");
	if (resId > 0) {
		ivShadow.setBackgroundResource(resId);
	}
	FrameLayout.LayoutParams lpSd = new FrameLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	ivShadow.setLayoutParams(lpSd);
	flPage.addView(ivShadow);

	// 請求數據
	followList.performPulling(true);
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:58,代碼來源:FollowListPage.java

示例15: afterPlatformListGot

/** display platform list */
public void afterPlatformListGot() {
	int size = platformList == null ? 0 : platformList.length;
	views = new View[size];

	final int dp_24 = dipToPx(getContext(), 24);
	LayoutParams lpItem = new LayoutParams(dp_24, dp_24);
	final int dp_9 = dipToPx(getContext(), 9);
	lpItem.setMargins(0, 0, dp_9, 0);
	FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	lpMask.gravity = Gravity.LEFT | Gravity.TOP;
	int selection = 0;
	for (int i = 0; i < size; i++) {
		FrameLayout fl = new FrameLayout(getContext());
		fl.setLayoutParams(lpItem);
		if (i >= size - 1) {
			fl.setLayoutParams(new LayoutParams(dp_24, dp_24));
		}
		llPlat.addView(fl);
		fl.setOnClickListener(this);

		ImageView iv = new ImageView(getContext());
		iv.setScaleType(ScaleType.CENTER_INSIDE);
		iv.setImageBitmap(getPlatLogo(platformList[i]));
		iv.setLayoutParams(new FrameLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		fl.addView(iv);

		views[i] = new View(getContext());
		views[i].setBackgroundColor(0xcfffffff);
		views[i].setOnClickListener(this);
		String platformName = platformList[i].getName();
		for(Platform plat : platforms) {
			if(platformName.equals(plat.getName())) {
				views[i].setVisibility(View.INVISIBLE);
				selection = i;
			}
		}
		views[i].setLayoutParams(lpMask);
		fl.addView(views[i]);
	}

	final int postSel = selection;
	UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
		public boolean handleMessage(Message msg) {
			HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
			hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
			return false;
		}
	});
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:52,代碼來源:EditPage.java


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