本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
}
示例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);
}
示例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;
}
示例15: getLayoutingHeight
@Override
public int getLayoutingHeight() {
return LayoutParams.WRAP_CONTENT;
}