本文整理汇总了Java中android.widget.RelativeLayout.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java RelativeLayout.LayoutParams方法的具体用法?Java RelativeLayout.LayoutParams怎么用?Java RelativeLayout.LayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.LayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addText
import android.widget.RelativeLayout; //导入方法依赖的package包/类
public void addText(String text, int colorCodeTextView) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
addTextRootView = inflater.inflate(R.layout.photo_editor_sdk_text_item_list, null);
TextView addTextView = (TextView) addTextRootView.findViewById(R.id.photo_editor_sdk_text_tv);
addTextView.setGravity(Gravity.CENTER);
addTextView.setText(text);
if (colorCodeTextView != -1)
addTextView.setTextColor(colorCodeTextView);
MultiTouchListener multiTouchListener = new MultiTouchListener(deleteView,
parentView, this.imageView, onPhotoEditorSDKListener);
multiTouchListener.setOnMultiTouchListener(this);
addTextRootView.setOnTouchListener(multiTouchListener);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
parentView.addView(addTextRootView, params);
addedViews.add(addTextRootView);
if (onPhotoEditorSDKListener != null)
onPhotoEditorSDKListener.onAddViewListener(ViewType.TEXT, addedViews.size());
}
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:21,代码来源:PhotoEditorSDK.java示例2: returnBackWithSavedImage
import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void returnBackWithSavedImage() {
updateView(View.GONE);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
parentImageRelativeLayout.setLayoutParams(layoutParams);
new CountDownTimer(1000, 500) {
public void onTick(long millisUntilFinished) {
}
public void onFinish() {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageName = "IMG_" + timeStamp + ".jpg";
Intent returnIntent = new Intent();
returnIntent.putExtra("imagePath", photoEditorSDK.saveImage("PhotoEditorSDK", imageName));
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
}.start();
}
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:22,代码来源:PhotoEditorActivity.java示例3: createRecyclerView
import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void createRecyclerView() {
rvMonths = new SlowdownRecyclerView(getContext());
rvMonths.setId(View.generateViewId());
rvMonths.setHasFixedSize(true);
rvMonths.setNestedScrollingEnabled(false);
((SimpleItemAnimator) rvMonths.getItemAnimator()).setSupportsChangeAnimations(false);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.BELOW, llDaysOfWeekTitles.getId());
rvMonths.setLayoutParams(params);
rvMonths.setLayoutManager(new GridLayoutManager(getContext(), 1, settingsManager.getCalendarOrientation(), false));
monthAdapter = createAdapter();
changeSnapHelper();
rvMonths.setAdapter(monthAdapter);
rvMonths.scrollToPosition(SettingsManager.DEFAULT_MONTH_COUNT / 2);
rvMonths.addOnScrollListener(pagingScrollListener);
rvMonths.getRecycledViewPool().setMaxRecycledViews(ItemViewType.MONTH, 10);
addView(rvMonths);
}
开发者ID:ApplikeySolutions,项目名称:CosmoCalendar,代码行数:23,代码来源:CalendarView.java示例4: onStart
import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public void onStart() {
super.onStart();
Bundle b = getArguments();
if (b != null) {
LocationChronicleEvent loc = (LocationChronicleEvent) b.getSerializable(ARGUMENT_PLACE_JSON);
locationChronicleEvent = loc;
RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
p.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
p.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
//getView().setId(R.id.fragmentDetails);
p.addRule(RelativeLayout.ALIGN_PARENT_START);
getView().setLayoutParams(p);
TextView textViewBarName = (TextView) getView().findViewById(R.id.textViewBarName);
textViewBarName.setText(locationChronicleEvent.getLocationName());
TextView textViewType = (TextView) getView().findViewById(R.id.textViewType);
textViewType.setText(locationChronicleEvent.getType());
}
}
开发者ID:Bartout-Team,项目名称:Bartout,代码行数:22,代码来源:BarDetailsFragment.java示例5: needLayout
import android.widget.RelativeLayout; //导入方法依赖的package包/类
public void needLayout() {
if (AndroidUtilities.isTablet()) {
RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams)layersActionBarLayout.getLayoutParams();
relativeLayoutParams.leftMargin = (AndroidUtilities.displaySize.x - relativeLayoutParams.width) / 2;
int y = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
relativeLayoutParams.topMargin = y + (AndroidUtilities.displaySize.y - relativeLayoutParams.height - y) / 2;
layersActionBarLayout.setLayoutParams(relativeLayoutParams);
if (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
int leftWidth = AndroidUtilities.displaySize.x / 100 * 35;
if (leftWidth < AndroidUtilities.dp(320)) {
leftWidth = AndroidUtilities.dp(320);
}
relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams();
relativeLayoutParams.width = leftWidth;
relativeLayoutParams.height = LayoutHelper.MATCH_PARENT;
actionBarLayout.setLayoutParams(relativeLayoutParams);
if (AndroidUtilities.isSmallTablet() && actionBarLayout.fragmentsStack.size() == 2) {
BaseFragment chatFragment = actionBarLayout.fragmentsStack.get(1);
chatFragment.onPause();
actionBarLayout.fragmentsStack.remove(1);
actionBarLayout.showLastFragment();
}
} else {
relativeLayoutParams = (RelativeLayout.LayoutParams) actionBarLayout.getLayoutParams();
relativeLayoutParams.width = LayoutHelper.MATCH_PARENT;
relativeLayoutParams.height = LayoutHelper.MATCH_PARENT;
actionBarLayout.setLayoutParams(relativeLayoutParams);
}
}
}
开发者ID:MLNO,项目名称:airgram,代码行数:35,代码来源:ManageSpaceActivity.java示例6: initStatusHeight
import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void initStatusHeight() {
int statusHeight = ScreenUtils.getStatusHeight(getActivity());
ViewGroup.LayoutParams statusParams = status.getLayoutParams();
statusParams.height = statusHeight;
status.setLayoutParams(statusParams);
ViewGroup.LayoutParams params = appbar.getLayoutParams();
params.height = params.height + statusHeight;
appbar.setLayoutParams(params);
RelativeLayout.LayoutParams dl2Params = (RelativeLayout.LayoutParams) rootdl.getLayoutParams();
dl2Params.topMargin = dl2Params.topMargin + statusHeight;
rootdl.setLayoutParams(dl2Params);
}
开发者ID:weimin96,项目名称:shareNote,代码行数:15,代码来源:MainFragment.java示例7: show
import android.widget.RelativeLayout; //导入方法依赖的package包/类
public static void show(MsgView msgView, int num) {
if (msgView == null) {
return;
}
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) msgView.getLayoutParams();
DisplayMetrics dm = msgView.getResources().getDisplayMetrics();
msgView.setVisibility(View.VISIBLE);
if (num <= 0) {//圆点,设置默认宽高
msgView.setStrokeWidth(0);
msgView.setText("");
lp.width = (int) (5 * dm.density);
lp.height = (int) (5 * dm.density);
msgView.setLayoutParams(lp);
} else {
lp.height = (int) (18 * dm.density);
if (num > 0 && num < 10) {//圆
lp.width = (int) (18 * dm.density);
msgView.setText(num + "");
} else if (num > 9 && num < 100) {//圆角矩形,圆角是高度的一半,设置默认padding
lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
msgView.setText(num + "");
} else {//数字超过两位,显示99+
lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
msgView.setText("99+");
}
msgView.setLayoutParams(lp);
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:UnreadMsgUtils.java示例8: centerDot
import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void centerDot() {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) dot.getLayoutParams();
params.leftMargin = (int) ((joystickWidth / 2f) - (dotSize / 2f));
params.topMargin = (int) ((joystickHeight / 2f) - (dotSize / 2f));
dot.setLayoutParams(params);
}
开发者ID:Make-A-Pede,项目名称:Make-A-Pede-Android-App,代码行数:9,代码来源:JoystickView.java示例9: run
import android.widget.RelativeLayout; //导入方法依赖的package包/类
/** 动态适配编辑界面的高度 */
public void run() {
int height = svContent.getChildAt(0).getHeight();
RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
if (height > maxBodyHeight && lp.height != maxBodyHeight) {
lp.height = maxBodyHeight;
svContent.setLayoutParams(lp);
} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
lp.height = LayoutParams.WRAP_CONTENT;
svContent.setLayoutParams(lp);
}
}
开发者ID:auv1107,项目名称:TextEmoji,代码行数:13,代码来源:EditPage.java示例10: addNewCard
import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
* Adds a new card to the specified stack. Also performs all the necessary layout setup
* to place the card in the correct position.
*/
public void addNewCard(int stack) {
CardView view = new CardView(this);
view.updateTranslation(mStackCards.get(stack).size());
view.setCardFlipListener(this);
view.setPadding(mHorizontalPadding, mVerticalPadding, mHorizontalPadding, mVerticalPadding);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(mCardWidth,
mCardHeight);
params.topMargin = 0;
params.leftMargin = (stack == RIGHT_STACK ? mCardWidth : 0);
mStackCards.get(stack).add(view);
mLayout.addView(view, params);
}
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:19,代码来源:CardFlip.java示例11: addIndicatorView
import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
* 装载IndicatorView
*/
private void addIndicatorView() {
if (IndicatorManager.getInstance().getIndicatorType() == POINT_INDICATOR && mIndicator != null) {
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
layoutParams.bottomMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getContext().getResources().getDisplayMetrics());
mContainer.addView(mIndicator, layoutParams);
}
}
开发者ID:ryanlijianchang,项目名称:AdPlayBanner,代码行数:12,代码来源:ScrollerPager.java示例12: setHeaderView
import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
* 添加头布局
*
* @param child
*/
public void setHeaderView(View child) {
if (child == null) {
return;
}
if (mHeadViewContainer == null) {
return;
}
usingDefaultHeader = false;
mHeadViewContainer.removeAllViews();
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
mHeaderViewWidth, mHeaderViewHeight);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mHeadViewContainer.addView(child, layoutParams);
}
开发者ID:GaoGersy,项目名称:MultiSelecter,代码行数:20,代码来源:SuperSwipeRefreshLayout.java示例13: setSize
import android.widget.RelativeLayout; //导入方法依赖的package包/类
public static void setSize(MsgView rtv, int size) {
if (rtv == null) {
return;
}
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) rtv.getLayoutParams();
lp.width = size;
lp.height = size;
rtv.setLayoutParams(lp);
}
开发者ID:Kelvin65535,项目名称:Android_Songshuhui,代码行数:10,代码来源:UnreadMsgUtils.java示例14: replaceLayout
import android.widget.RelativeLayout; //导入方法依赖的package包/类
private boolean replaceLayout(View target) {
if (getParent() != null || target == null || target.getParent() == null || _labelViewContainerID != -1) {
return false;
}
ViewGroup parentContainer = (ViewGroup) target.getParent();
if (target.getParent() instanceof FrameLayout) {
((FrameLayout) target.getParent()).addView(this);
} else if (target.getParent() instanceof ViewGroup) {
int groupIndex = parentContainer.indexOfChild(target);
_labelViewContainerID = generateViewId();
// relativeLayout need copy rule
if (target.getParent() instanceof RelativeLayout) {
for (int i = 0; i < parentContainer.getChildCount(); i++) {
if (i == groupIndex) {
continue;
}
View view = parentContainer.getChildAt(i);
RelativeLayout.LayoutParams para = (RelativeLayout.LayoutParams) view.getLayoutParams();
for (int j = 0; j < para.getRules().length; j++) {
if (para.getRules()[j] == target.getId()) {
para.getRules()[j] = _labelViewContainerID;
}
}
view.setLayoutParams(para);
}
}
parentContainer.removeView(target);
// new dummy layout
FrameLayout labelViewContainer = new FrameLayout(getContext());
ViewGroup.LayoutParams targetLayoutParam = target.getLayoutParams();
labelViewContainer.setLayoutParams(targetLayoutParam);
target.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
// add target and label in dummy layout
labelViewContainer.addView(target);
labelViewContainer.addView(this);
labelViewContainer.setId(_labelViewContainerID);
// add dummy layout in parent container
parentContainer.addView(labelViewContainer, groupIndex, targetLayoutParam);
}
return true;
}
开发者ID:open-android,项目名称:labelview,代码行数:50,代码来源:LabelView.java示例15: initTitle
import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void initTitle(RelativeLayout rlTitle, float ratio) {
tvCancel = new TextView(activity);
tvCancel.setTextColor(0xff3b3b3b);
tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
tvCancel.setGravity(Gravity.CENTER);
int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel");
if (resId > 0) {
tvCancel.setText(resId);
}
int padding = (int) (DESIGN_LEFT_PADDING * ratio);
tvCancel.setPadding(padding, 0, padding, 0);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
rlTitle.addView(tvCancel, lp);
tvCancel.setOnClickListener(this);
TextView tvTitle = new TextView(activity);
tvTitle.setTextColor(0xff3b3b3b);
tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
tvTitle.setGravity(Gravity.CENTER);
resId = ResHelper.getStringRes(activity, "ssdk_oks_multi_share");
if (resId > 0) {
tvTitle.setText(resId);
}
lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
lp.addRule(RelativeLayout.CENTER_IN_PARENT);
rlTitle.addView(tvTitle, lp);
tvShare = new TextView(activity);
tvShare.setTextColor(0xffff6d11);
tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
tvShare.setGravity(Gravity.CENTER);
resId = ResHelper.getStringRes(activity, "ssdk_oks_share");
if (resId > 0) {
tvShare.setText(resId);
}
tvShare.setPadding(padding, 0, padding, 0);
lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
rlTitle.addView(tvShare, lp);
tvShare.setOnClickListener(this);
}
开发者ID:lo625090140,项目名称:lqrwechatrongcloud,代码行数:42,代码来源:EditPageLand.java本文标签属性:
示例:示例是什么意思
代码:代码生成器
java:java面试题
RelativeLayout:relativelayout布局
LayoutParams:LayoutParams