Back to project page JiangHomeStyle_Android_Phone.
The source code is released under:
Apache License
If you think the Android project JiangHomeStyle_Android_Phone listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.cidesign.jianghomestylephone.tools; /*from w w w .ja va2 s. co m*/ import com.cidesign.jianghomestylephone.entity.LayoutEntity; import com.cidesign.jianghomestylephone.entity.RelativeLayoutRulesEntity; import android.view.WindowManager.LayoutParams; import android.widget.LinearLayout; import android.widget.RelativeLayout; public class LayoutMarginSetting { /** * * @param layoutEntity * @return */ public static LinearLayout.LayoutParams getLinearLayoutParams(LayoutEntity layoutEntity) { LinearLayout.LayoutParams globalImageViewLayout = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); globalImageViewLayout.width = layoutEntity.getWidth(); globalImageViewLayout.height = layoutEntity.getHeight(); globalImageViewLayout.leftMargin = layoutEntity.getLeftMargin(); globalImageViewLayout.rightMargin = layoutEntity.getRightMargin(); globalImageViewLayout.topMargin = layoutEntity.getTopMargin(); globalImageViewLayout.bottomMargin = layoutEntity.getBottomMargin(); return globalImageViewLayout; } /** * * @param layoutEntity * @return */ public static RelativeLayout.LayoutParams getRelativeLayoutParams(LayoutEntity layoutEntity) { RelativeLayout.LayoutParams bigImageViewLayout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); bigImageViewLayout.width = layoutEntity.getWidth(); bigImageViewLayout.height = layoutEntity.getHeight(); bigImageViewLayout.leftMargin = layoutEntity.getLeftMargin(); bigImageViewLayout.rightMargin = layoutEntity.getRightMargin(); bigImageViewLayout.topMargin = layoutEntity.getTopMargin(); bigImageViewLayout.bottomMargin = layoutEntity.getBottomMargin(); return bigImageViewLayout; } /** * * @param layoutEntity * @param ruleENtity * @return */ public static RelativeLayout.LayoutParams getRelativeLayoutDetailParams(LayoutEntity layoutEntity, RelativeLayoutRulesEntity ruleENtity) { RelativeLayout.LayoutParams bigImageViewLayout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); bigImageViewLayout.width = layoutEntity.getWidth(); bigImageViewLayout.height = layoutEntity.getHeight(); bigImageViewLayout.leftMargin = layoutEntity.getLeftMargin(); bigImageViewLayout.rightMargin = layoutEntity.getRightMargin(); bigImageViewLayout.topMargin = layoutEntity.getTopMargin(); bigImageViewLayout.bottomMargin = layoutEntity.getBottomMargin(); if (ruleENtity.getBelowOfValue() != 0) { bigImageViewLayout.addRule(RelativeLayout.BELOW, ruleENtity.getBelowOfValue()); } if (ruleENtity.getRightOfVlaue() != 0) { bigImageViewLayout.addRule(RelativeLayout.RIGHT_OF, ruleENtity.getRightOfVlaue()); } if (ruleENtity.getLeftOfValue() != 0) { bigImageViewLayout.addRule(RelativeLayout.LEFT_OF, ruleENtity.getRightOfVlaue()); } return bigImageViewLayout; } }