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


Java LayoutParams.WRAP_CONTENT属性代码示例

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


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

示例1: getBodyBottom

private LinearLayout getBodyBottom() {
	LinearLayout llBottom = new LinearLayout(getContext());
	llBottom.setLayoutParams(new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

	String platform = String.valueOf(reqData.get("platform"));
	LinearLayout line = getAtLine(platform);
	if (line != null) {
		llBottom.addView(line);
	}

	// 字数统计
	tvCounter = new TextView(getContext());
	tvCounter.setText(String.valueOf(MAX_TEXT_COUNT));
	tvCounter.setTextColor(0xffcfcfcf);
	tvCounter.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	tvCounter.setTypeface(Typeface.DEFAULT_BOLD);
	LinearLayout.LayoutParams lpCounter = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpCounter.gravity = Gravity.CENTER_VERTICAL;
	tvCounter.setLayoutParams(lpCounter);
	llBottom.addView(tvCounter);

	return llBottom;
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:25,代码来源:EditPage.java

示例2: getPageBody

private LinearLayout getPageBody() {
	llBody = new LinearLayout(getContext());
	llBody.setId(2);
	int resId = getBitmapRes(activity, "edittext_back");
	if (resId > 0) {
		llBody.setBackgroundResource(resId);
	}
	llBody.setOrientation(LinearLayout.VERTICAL);
	RelativeLayout.LayoutParams lpBody = new RelativeLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpBody.addRule(RelativeLayout.ALIGN_LEFT, llTitle.getId());
	lpBody.addRule(RelativeLayout.BELOW, llTitle.getId());
	lpBody.addRule(RelativeLayout.ALIGN_RIGHT, llTitle.getId());
	if (!dialogMode) {
		lpBody.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	}
	int dp_3 = dipToPx(getContext(), 3);
	lpBody.setMargins(dp_3, dp_3, dp_3, dp_3);
	llBody.setLayoutParams(lpBody);

	llBody.addView(getMainBody());
	llBody.addView(getSep());
	llBody.addView(getPlatformList());

	return llBody;
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:26,代码来源:EditPage.java

示例3: getBodyBottom

private LinearLayout getBodyBottom() {
	LinearLayout llBottom = new LinearLayout(getContext());
	llBottom.setLayoutParams(new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

	LinearLayout line = getAtLine(platforms.get(0).getName());
	if (line != null) {
		llBottom.addView(line);
	}

	// Words counter
	tvCounter = new TextView(getContext());
	tvCounter.setText(String.valueOf(MAX_TEXT_COUNT));
	tvCounter.setTextColor(0xffcfcfcf);
	tvCounter.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	tvCounter.setTypeface(Typeface.DEFAULT_BOLD);
	LayoutParams lpCounter = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpCounter.gravity = Gravity.CENTER_VERTICAL;
	tvCounter.setLayoutParams(lpCounter);
	llBottom.addView(tvCounter);

	return llBottom;
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:24,代码来源:EditPage.java

示例4: PopuWindowView

public PopuWindowView(Context mContext, int widthGravity) {
    this.mContext = mContext;
    LayoutInflater inflater = LayoutInflater.from(mContext);
    viewItem = inflater.inflate(R.layout.dialogui_popu_options, null);
    pupoListView = (ListView) viewItem.findViewById(R.id.customui_list);
    mPopuWindowAdapter = new PopuWindowAdapter(mContext, popuLists);
    pupoListView.setAdapter(mPopuWindowAdapter);
    pullDownView = new PopupWindow(viewItem, widthGravity,
            LayoutParams.WRAP_CONTENT, true);
    pullDownView.setOutsideTouchable(true);
    pullDownView.setBackgroundDrawable(new BitmapDrawable());
    pupoListView.setOnItemClickListener(this);
}
 
开发者ID:weileng11,项目名称:KUtils-master,代码行数:13,代码来源:PopuWindowView.java

示例5: 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

示例6: 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

示例7: getPageTitle

private TitleLayout getPageTitle() {
		llTitle = new TitleLayout(getContext());
		llTitle.setId(1);
//		int resId = getBitmapRes(activity, "title_back");
//		if (resId > 0) {
//			llTitle.setBackgroundResource(resId);
//		}
		llTitle.getBtnBack().setOnClickListener(this);
		int resId = getStringRes(activity, "multi_share");
		if (resId > 0) {
			llTitle.getTvTitle().setText(resId);
		}
		llTitle.getBtnRight().setVisibility(View.VISIBLE);
		resId = getStringRes(activity, "share");
		if (resId > 0) {
			llTitle.getBtnRight().setText(resId);
		}
		llTitle.getBtnRight().setOnClickListener(this);
		RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
		lp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
		lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
		llTitle.setLayoutParams(lp);

		return llTitle;
	}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:27,代码来源:EditPage.java

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: disableButton

public void disableButton(int id)
{
    View button = findViewById(id);
    final View other = findViewById(id == R.id.dialog_button_ok ? R.id.dialog_button_cancel : R.id.dialog_button_ok);
    if (button != null && other != null)
    {
        button.setVisibility(View.GONE);
        LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        lp.setMargins(0, 0, 0, getContext().getResources().getDimensionPixelSize(R.dimen.dialog_buttons_margin));
        other.setLayoutParams(lp);
        findViewById(R.id.dialog_button_devider).setVisibility(View.GONE);
    }
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:13,代码来源:SimpleDialog.java

示例13: 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

示例14: getAtLine

private LinearLayout getAtLine(String platform) {
	if (!isShowAtUserLayout(platform)) {
		return null;
	}
	LinearLayout llAt = new LinearLayout(getContext());
	LayoutParams lpAt = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpAt.rightMargin = dipToPx(getContext(), 4);
	lpAt.gravity = Gravity.LEFT | Gravity.BOTTOM;
	lpAt.weight = 1;
	llAt.setLayoutParams(lpAt);
	llAt.setOnClickListener(new OnClickListener() {
		public void onClick(View v) {
			FollowListPage subPage = new FollowListPage();
			subPage.setPlatform(platforms.get(0));
			subPage.showForResult(activity, null, EditPage.this);
		}
	});

	TextView tvAt = new TextView(getContext());
	int resId = getBitmapRes(activity, "btn_back_nor");
	if (resId > 0) {
		tvAt.setBackgroundResource(resId);
	}
	int dp_32 = dipToPx(getContext(), 32);
	tvAt.setLayoutParams(new LayoutParams(dp_32, dp_32));
	tvAt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	tvAt.setText(getAtUserButtonText(platform));
	int dp_2 = dipToPx(getContext(), 2);
	tvAt.setPadding(0, 0, 0, dp_2);
	tvAt.setTypeface(Typeface.DEFAULT_BOLD);
	tvAt.setTextColor(0xff000000);
	tvAt.setGravity(Gravity.CENTER);
	llAt.addView(tvAt);

	TextView tvName = new TextView(getContext());
	tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	tvName.setTextColor(0xff000000);
	resId = getStringRes(activity, "list_friends");
	String text = getContext().getString(resId, getName(platform));
	tvName.setText(text);
	LayoutParams lpName = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpName.gravity = Gravity.CENTER_VERTICAL;
	tvName.setLayoutParams(lpName);
	llAt.addView(tvName);

	return llAt;
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:49,代码来源:EditPage.java

示例15: getLayoutingHeight

@Override
public int getLayoutingHeight() {
    return LayoutParams.WRAP_CONTENT;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:4,代码来源:GlowPadView.java


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