类android.widget.LinearLayout.LayoutParams源码实例Demo

下面列出了怎么用android.widget.LinearLayout.LayoutParams的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FimiX8-RE   文件: X8TabHost.java
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int i;
    int modeWidth = MeasureSpec.getMode(widthMeasureSpec);
    int modeHeight = MeasureSpec.getMode(heightMeasureSpec);
    int sizeWidth = MeasureSpec.getSize(widthMeasureSpec);
    int sizeHeight = MeasureSpec.getSize(heightMeasureSpec);
    if (modeWidth != NTLMConstants.FLAG_NEGOTIATE_KEY_EXCHANGE && this.tabWidth > -1) {
        for (i = 0; i < getChildCount(); i++) {
            ((LayoutParams) ((TextView) getChildAt(i)).getLayoutParams()).width = this.tabWidth;
        }
    }
    if (modeHeight != NTLMConstants.FLAG_NEGOTIATE_KEY_EXCHANGE && this.tabHeight > -1) {
        for (i = 0; i < getChildCount(); i++) {
            ((LayoutParams) ((TextView) getChildAt(i)).getLayoutParams()).height = this.tabHeight;
        }
    }
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
 
源代码2 项目: BigApp_WordPress_Android   文件: EditPage.java
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;
}
 
源代码3 项目: DroidForce   文件: WaitPDPActivity.java
/**
 * Setup the layout for the activity
 */
private void setLayout() {		
	Log.i("DroidForce", "Setting up layout...");
	LinearLayout llayout = new LinearLayout(this);

	LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams( 
			LinearLayout.LayoutParams.FILL_PARENT,
			LinearLayout.LayoutParams.FILL_PARENT);

	llayout.setBackgroundDrawable(loadBackground());
	llayout.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
	
       TextView tv = new TextView(this);
       LayoutParams lpView = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
       tv.setText("Powered by DroidForce.");
       tv.setLayoutParams(lpView);  
       
       llayout.addView(tv);
	
	setContentView(llayout);
	

}
 
源代码4 项目: WeCenterMobile-Android   文件: EditPage.java
private RelativeLayout getPageView() {
	rlPage = new RelativeLayout(getContext());
	rlPage.setBackgroundDrawable(background);
	if (dialogMode) {
		RelativeLayout rlDialog = new RelativeLayout(getContext());
		rlDialog.setBackgroundColor(0xc0323232);
		int dp_8 = dipToPx(getContext(), 8);
		int width = getScreenWidth(getContext()) - dp_8 * 2;
		RelativeLayout.LayoutParams lpDialog = new RelativeLayout.LayoutParams(
				width, LayoutParams.WRAP_CONTENT);
		lpDialog.topMargin = dp_8;
		lpDialog.bottomMargin = dp_8;
		lpDialog.addRule(RelativeLayout.CENTER_IN_PARENT);
		rlDialog.setLayoutParams(lpDialog);
		rlPage.addView(rlDialog);

		rlDialog.addView(getPageTitle());
		rlDialog.addView(getPageBody());
		rlDialog.addView(getImagePin());
	} else {
		rlPage.addView(getPageTitle());
		rlPage.addView(getPageBody());
		rlPage.addView(getImagePin());
	}
	return rlPage;
}
 
源代码5 项目: RxAndroidBootstrap   文件: DownExpandAnimation.java
public static void expand(final View v) {
    v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    final int targtetHeight = v.getMeasuredHeight();

    v.getLayoutParams().height = 0;
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation()
    {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1
                    ? LayoutParams.WRAP_CONTENT
                    : (int)(targtetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration(500);
    v.startAnimation(a);
}
 
源代码6 项目: WeCenterMobile-Android   文件: EditPage.java
private ImageView getImagePin() {
	ivPin = new ImageView(getContext());
	int resId = getBitmapRes(activity, "pin");
	if (resId > 0) {
		ivPin.setImageResource(resId);
	}
	int dp_80 = dipToPx(getContext(), 80);
	int dp_36 = dipToPx(getContext(), 36);
	RelativeLayout.LayoutParams lp
			= new RelativeLayout.LayoutParams(dp_80, dp_36);
	lp.topMargin = dipToPx(getContext(), 6);
	lp.addRule(RelativeLayout.ALIGN_TOP, llBody.getId());
	lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	ivPin.setLayoutParams(lp);
	ivPin.setVisibility(View.GONE);

	return ivPin;
}
 
源代码7 项目: spidey   文件: MainActivity.java
public void addView(View view, int margin) {
	/**
	 * <Button android:text="Scan Result 1" android:textSize="24sp"
	 * android:textColor="#000000"
	 * 
	 * android:background="#cc999999"
	 * android:layout_height="wrap_content"
	 * android:layout_width="match_parent" android:gravity="center"
	 * android:layout_margin="6dp"
	 */
	
	LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.WRAP_CONTENT);
	lp.setMargins(margin,margin,margin,margin);
	mViewResults.addView(view, lp);
	
	
}
 
源代码8 项目: BigApp_WordPress_Android   文件: EditPage.java
private ImageView getImagePin() {
	ivPin = new ImageView(getContext());
	int resId = getBitmapRes(activity, "pin");
	if (resId > 0) {
		ivPin.setImageResource(resId);
	}
	int dp_80 = dipToPx(getContext(), 80);
	int dp_36 = dipToPx(getContext(), 36);
	RelativeLayout.LayoutParams lp
			= new RelativeLayout.LayoutParams(dp_80, dp_36);
	lp.topMargin = dipToPx(getContext(), 6);
	lp.addRule(RelativeLayout.ALIGN_TOP, llBody.getId());
	lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	ivPin.setLayoutParams(lp);
	ivPin.setVisibility(View.GONE);

	return ivPin;
}
 
源代码9 项目: AndroidLinkup   文件: EditPage.java
private RelativeLayout getPageView() {
	rlPage = new RelativeLayout(getContext());
	rlPage.setBackgroundDrawable(background);
	if (dialogMode) {
		RelativeLayout rlDialog = new RelativeLayout(getContext());
		rlDialog.setBackgroundColor(0xc0323232);
		int dp_8 = dipToPx(getContext(), 8);
		int width = getScreenWidth(getContext()) - dp_8 * 2;
		RelativeLayout.LayoutParams lpDialog = new RelativeLayout.LayoutParams(
				width, LayoutParams.WRAP_CONTENT);
		lpDialog.topMargin = dp_8;
		lpDialog.bottomMargin = dp_8;
		lpDialog.addRule(RelativeLayout.CENTER_IN_PARENT);
		rlDialog.setLayoutParams(lpDialog);
		rlPage.addView(rlDialog);

		rlDialog.addView(getPageTitle());
		rlDialog.addView(getPageBody());
		rlDialog.addView(getImagePin());
	} else {
		rlPage.addView(getPageTitle());
		rlPage.addView(getPageBody());
		rlPage.addView(getImagePin());
	}
	return rlPage;
}
 
源代码10 项目: letv   文件: MainBottomNavigationView.java
public void setNavigations() {
    removeAllViews();
    int height = UIsUtils.dipToPx(49.0f);
    NavigationType[] types = NavigationType.values();
    int len = types.length;
    for (int i = 0; i < len; i++) {
        LayoutParams params = new LayoutParams(height, height);
        if (i == 0) {
            params.leftMargin = UIsUtils.dipToPx(14.0f);
        } else {
            params.leftMargin = ((UIsUtils.getScreenWidth() - (UIsUtils.dipToPx(14.0f) * 2)) - (len * height)) / (len - 1);
        }
        BottomNavigationItemView itemView = new BottomNavigationItemView(this, this.mContext);
        itemView.setData(types[i]);
        addView(itemView, params);
    }
    setSelectedType(NavigationType.HOME);
}
 
@Override
public void onStart() {
  super.onStart();
  Window window = requireDialog().getWindow();
  // Dialogs use a background with an InsetDrawable by default, so we have to replace it.
  if (fullscreen) {
    window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    window.setBackgroundDrawable(background);
  } else {
    window.setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    int inset =
        getResources().getDimensionPixelOffset(R.dimen.mtrl_calendar_dialog_background_inset);
    Rect insets = new Rect(inset, inset, inset, inset);
    window.setBackgroundDrawable(new InsetDrawable(background, inset, inset, inset, inset));
    window
        .getDecorView()
        .setOnTouchListener(new InsetDialogOnTouchListener(requireDialog(), insets));
  }
  startPickerFragment();
}
 
源代码12 项目: debugdrawer   文件: DebugModule.java
private ViewGroup addChildren(DebugView parent) {
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    LinearLayout ll = new LinearLayout(parent.getContext());
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.setLayoutParams(new LayoutParams(MATCH_PARENT,WRAP_CONTENT));

    DisplayMetrics metrics = parent.getContext().getResources().getDisplayMetrics();
    int dp02 = (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, 2, metrics);
    int dp05 = (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, 5, metrics);
    ll.setPadding(dp05,dp02,0,0);

    // Attach this module elements and subModule elements
    attachElements(inflater,parent,ll,elements);
    for(DebugModule subModule : subModules) {
        attachElements(inflater,parent,ll,subModule.getElements());
    }

    return ll;
}
 
源代码13 项目: letv   文件: VideoShotEditActivity.java
public Object instantiateItem(ViewGroup container, int position) {
    RoundedImageView imageView;
    if (VideoShotEditActivity.this.photoFileName.getPhoto().size() > 1 && position == 0) {
        imageView = VideoShotEditActivity.this.createImageViewFromFile(position, ((PhotoInfoBean) VideoShotEditActivity.this.photoFileName.getPhoto().get(VideoShotEditActivity.this.photoFileName.getPhoto().size() - 1)).photoPath);
    } else if (VideoShotEditActivity.this.photoFileName.getPhoto().size() > 1 && position == VideoShotEditActivity.this.photoFileName.getPhoto().size() + 1) {
        imageView = VideoShotEditActivity.this.createImageViewFromFile(position, ((PhotoInfoBean) VideoShotEditActivity.this.photoFileName.getPhoto().get(0)).photoPath);
    } else if (VideoShotEditActivity.this.photoFileName.getPhoto().size() > 1) {
        imageView = VideoShotEditActivity.this.createImageViewFromFile(position, ((PhotoInfoBean) VideoShotEditActivity.this.photoFileName.getPhoto().get(position - 1)).photoPath);
    } else {
        imageView = VideoShotEditActivity.this.createImageViewFromFile(position, ((PhotoInfoBean) VideoShotEditActivity.this.photoFileName.getPhoto().get(position)).photoPath);
    }
    LogInfo.log("fornia", "setupJazziness instantiateItem position:" + position + "|jazzy.getChildCount():" + VideoShotEditActivity.this.jazzy.getChildCount());
    if (imageView != null) {
        imageView.setTag(Integer.valueOf(position));
        imageView.setScaleType(ScaleType.FIT_XY);
        LayoutParams params_imageview = new LayoutParams(-1, -1);
        params_imageview.gravity = 17;
        imageView.setLayoutParams(params_imageview);
        container.addView(imageView, -1, -1);
        VideoShotEditActivity.this.jazzy.setObjectForPosition(imageView, position);
    }
    return imageView;
}
 
源代码14 项目: ShareSDKShareDifMsgDemo-Android   文件: EditPage.java
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;
}
 
源代码15 项目: MVPAndroidBootstrap   文件: ExpandAnimation.java
public static void expand(final View v) {
    v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    final int targtetHeight = v.getMeasuredHeight();

    v.getLayoutParams().height = 0;
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation()
    {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1
                    ? LayoutParams.WRAP_CONTENT
                    : (int)(targtetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration(500);
    v.startAnimation(a);
}
 
源代码16 项目: MVPAndroidBootstrap   文件: DownExpandAnimation.java
public static void expand(final View v) {
    v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    final int targtetHeight = v.getMeasuredHeight();

    v.getLayoutParams().height = 0;
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation()
    {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1
                    ? LayoutParams.WRAP_CONTENT
                    : (int)(targtetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration(500);
    v.startAnimation(a);
}
 
源代码17 项目: Android-Bootstrap   文件: BootstrapDropDown.java
private void createDropDown() {
    ScrollView dropdownView = createDropDownView();
    dropdownWindow = new PopupWindow();
    dropdownWindow.setFocusable(true);
    dropdownWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);

    if (!isInEditMode()) {
        dropdownWindow.setBackgroundDrawable(DrawableUtils.resolveDrawable(android.R.drawable
                                                                                   .dialog_holo_light_frame, getContext()));
    }

    dropdownWindow.setContentView(dropdownView);
    dropdownWindow.setOnDismissListener(this);
    dropdownWindow.setAnimationStyle(android.R.style.Animation_Activity);
    float longestStringWidth = measureStringWidth(getLongestString(dropdownData))
            + DimenUtils.dpToPixels((baselineItemRightPadding + baselineItemLeftPadding) * bootstrapSize);

    if (longestStringWidth < getMeasuredWidth()) {
        dropdownWindow.setWidth(DimenUtils.dpToPixels(getMeasuredWidth()));
    }
    else {
        dropdownWindow.setWidth((int) longestStringWidth + DimenUtils.dpToPixels(8));
    }
}
 
源代码18 项目: WeCenterMobile-Android   文件: EditPage.java
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;
}
 
源代码19 项目: BigApp_Discuz_Android   文件: EditPage.java
private ImageView getImagePin() {
	ivPin = new ImageView(getContext());
	int resId = getBitmapRes(activity, "pin");
	if (resId > 0) {
		ivPin.setImageResource(resId);
	}
	int dp_80 = dipToPx(getContext(), 80);
	int dp_36 = dipToPx(getContext(), 36);
	RelativeLayout.LayoutParams lp
			= new RelativeLayout.LayoutParams(dp_80, dp_36);
	lp.topMargin = dipToPx(getContext(), 6);
	lp.addRule(RelativeLayout.ALIGN_TOP, llBody.getId());
	lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	ivPin.setLayoutParams(lp);
	ivPin.setVisibility(View.GONE);

	return ivPin;
}
 
源代码20 项目: Huochexing12306   文件: EditPage.java
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;
}
 
源代码21 项目: CC   文件: LoginActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    callId = CCUtil.getNavigateCallId(this);
    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);
}
 
源代码22 项目: mollyim-android   文件: RationaleDialog.java
public static AlertDialog.Builder createFor(@NonNull Context context, @NonNull String message, @DrawableRes int... drawables) {
  View      view   = LayoutInflater.from(context).inflate(R.layout.permissions_rationale_dialog, null);
  ViewGroup header = view.findViewById(R.id.header_container);
  TextView  text   = view.findViewById(R.id.message);

  for (int i=0;i<drawables.length;i++) {
    Drawable drawable = ContextCompat.getDrawable(context, drawables[i]);
    DrawableCompat.setTint(drawable, ContextCompat.getColor(context, R.color.white));
    ImageView imageView = new ImageView(context);
    imageView.setImageDrawable(drawable);
    imageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    header.addView(imageView);

    if (i != drawables.length - 1) {
      TextView plus = new TextView(context);
      plus.setText("+");
      plus.setTextSize(TypedValue.COMPLEX_UNIT_SP, 40);
      plus.setTextColor(Color.WHITE);

      LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      layoutParams.setMargins(ViewUtil.dpToPx(context, 20), 0, ViewUtil.dpToPx(context, 20), 0);

      plus.setLayoutParams(layoutParams);
      header.addView(plus);
    }
  }

  text.setText(message);

  return new AlertDialog.Builder(context, ThemeUtil.isDarkTheme(context) ? R.style.Theme_Signal_AlertDialog_Dark_Cornered : R.style.Theme_Signal_AlertDialog_Light_Cornered)
                        .setView(view);
}
 
源代码23 项目: CameraV   文件: ChartsActivity.java
private void addMap (ArrayList<String> alPoints)
{
	String baseMap = "https://maps.googleapis.com/maps/api/staticmap?size=600x400";
	String basePath = "&path=color:0x0000ff|weight:5";
	
	StringBuffer mapUrl = new StringBuffer();
	mapUrl.append(baseMap);
	mapUrl.append(basePath);
	
	int max = 20;
	
	for (int i = 0; i < alPoints.size()&& i < max; i++)
	{
		mapUrl.append('|');
		mapUrl.append(alPoints.get(i));
	}
	
	ImageView iv = new ImageView(this);
	
	int dpHeight = 300;	       
       int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpHeight, getResources().getDisplayMetrics());

       LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
               LayoutParams.MATCH_PARENT, height);             
       viewChartGroup.addView(iv,params);
	
	new DownloadImageTask(iv).execute(mapUrl.toString());	
}
 
源代码24 项目: ShareSDKShareDifMsgDemo-Android   文件: EditPage.java
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;
}
 
源代码25 项目: SegmentedButton   文件: MainActivity.java
private void setupCountPButtonGroup()
{
    SegmentedButtonGroup buttonGroup = new SegmentedButtonGroup(this);
    buttonGroup.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    ((LinearLayout.LayoutParams)buttonGroup.getLayoutParams()).setMargins((int)dpToPx(32), (int)dpToPx(16),
        (int)dpToPx(32), (int)dpToPx(16));
    ((LayoutParams)buttonGroup.getLayoutParams()).gravity = Gravity.CENTER_HORIZONTAL;
    buttonGroup.setBorder(3, Color.LTGRAY, 0, 0);
    buttonGroup.setDivider(Color.DKGRAY, 5, 5, 5);
    buttonGroup.setOnPositionChangedListener(position -> {
        if (countPButtonGroup == null)
            return;

        countPButtonGroup.getButton(2).setText(countPButtonGroup.getButton(2).getText());
    });

    String[] names = {
        "Two",
        "One",
        "None"
    };

    for (String name : names)
    {
        SegmentedButton button = new SegmentedButton(this);
        button.setText(name);
        button.setTextSize(dpToPx(18));
        button.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        button.setPadding((int)dpToPx(20), (int)dpToPx(20), (int)dpToPx(20), (int)dpToPx(20));
        button.setTextColor(Color.BLACK);
        button.setSelectedTextColor(Color.WHITE);
        button.setSelectedBackgroundColor(getResources().getColor(R.color.colorPrimary));
        buttonGroup.addView(button);
    }

    linearLayout.addView(buttonGroup);
    countPButtonGroup = buttonGroup;
}
 
源代码26 项目: RxAndroidBootstrap   文件: ExpandAnimation.java
/**
 * Initialize the animation
 *
 * @param view
 *            The layout we want to animate
 * @param duration
 *            The duration of the animation, in ms
 */
public ExpandAnimation(View view, int duration) {

    setDuration(duration);
    mAnimatedView = view;
    mViewLayoutParams = (LayoutParams) view.getLayoutParams();

    // decide to show or hide the view
    mIsVisibleAfter = (view.getVisibility() == View.VISIBLE);

    mMarginStart = mViewLayoutParams.bottomMargin;
    mMarginEnd = (mMarginStart == 0 ? (0 - view.getHeight()) : 0);

    view.setVisibility(View.VISIBLE);
}
 
源代码27 项目: AndroidChromium   文件: DataReductionPromoScreen.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Keep the window full screen otherwise the flip animation will frame-skip.
    getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    addListenerOnButton();

    mState = DataReductionProxyUma.ACTION_DISMISSED;
}
 
源代码28 项目: AndroidChromium   文件: DataReductionPromoScreen.java
/**
 * DataReductionPromoScreen constructor.
 *
 * @param context An Android context.
 */
public DataReductionPromoScreen(Context context) {
    super(context, R.style.DataReductionPromoScreenDialog);
    setContentView(getContentView(context), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));

    // Remove the shadow from the enable button.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Button enableButton = (Button) findViewById(R.id.enable_button);
        enableButton.setStateListAnimator(null);
    }
}
 
public PRTHeader(Context context) {
	super(context);
	setOrientation(VERTICAL);

	LinearLayout llInner = new LinearLayout(context);
	LinearLayout.LayoutParams lpInner = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpInner.gravity = Gravity.CENTER_HORIZONTAL;
	addView(llInner, lpInner);

	ivArrow = new RotateImageView(context);
	int resId = getBitmapRes(context, "ssdk_oks_ptr_ptr");
	if (resId > 0) {
		ivArrow.setImageResource(resId);
	}
	int dp_32 = dipToPx(context, 32);
	LayoutParams lpIv = new LayoutParams(dp_32, dp_32);
	lpIv.gravity = Gravity.CENTER_VERTICAL;
	llInner.addView(ivArrow, lpIv);

	pbRefreshing = new ProgressBar(context);
	llInner.addView(pbRefreshing, lpIv);
	pbRefreshing.setVisibility(View.GONE);

	tvHeader = new TextView(getContext());
	tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	tvHeader.setGravity(Gravity.CENTER);
	int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 10);
	tvHeader.setPadding(dp_10, dp_10, dp_10, dp_10);
	tvHeader.setTextColor(0xff000000);
	LayoutParams lpTv = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpTv.gravity = Gravity.CENTER_VERTICAL;
	llInner.addView(tvHeader, lpTv);
}
 
源代码30 项目: ShareSDKShareDifMsgDemo-Android   文件: EditPage.java
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;
}
 
 类所在包
 同包方法