Android ViewGroup.MarginLayoutParams - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ViewGroup.MarginLayoutParams class.

This code example shows how to use the following methods:setMargins
			width = LayoutParams.FILL_PARENT;
		} 
		else{ 
			width = (Long) settings.get("width");
		} 
		LayoutParams p = new FrameLayout.LayoutParams((int)width,(int)height,0);
		p.setMargins((int)left, (int)top, (int)right, (int)bottom);
		return p;
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMarginStart
    /** 
     * @see android.view.ViewGroup.MarginLayoutParams#setMarginStart(int) 
     */ 
    public static void setMarginStart(MarginLayoutParams layoutParams, int start) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            layoutParams.setMarginStart(start);
        } else { 
            layoutParams.leftMargin = start;
        } 
    } 
 
    /** 
     * @see android.view.ViewGroup.MarginLayoutParams#getMarginStart() 
     */ 
    public static int getMarginStart(MarginLayoutParams layoutParams) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return layoutParams.getMarginStart();
        } else { 
            return layoutParams.leftMargin;
        } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMargins
	private LoadTimeDate(){} 
	 
	public void getView(int choice, int integerId, int integerWidth, int integerHeight, int integerLayoutX, int integerLayoutY, String text ) {
 
		if (choice == 0) {
			params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
			context = Home.getHome().getLayout().getContext();
			TimePicker timePicker = new TimePicker(context);
			timePicker.setId(integerId);
			timePicker.setCurrentHour(hour);
			timePicker.setCurrentMinute(minute);
			timePicker.setBackgroundColor(Color.DKGRAY);
			timePicker.setScaleX(0.50f);
			timePicker.setScaleY(0.50f);
			params.setMargins(integerLayoutX, integerLayoutY, 0, 0);
			timePicker.setLayoutParams(params);
			Home.getHome().getLayout().addView(timePicker, params);
			timePicker.setOnTouchListener(new DragListener(timePicker));
			if (timePickerId > integerId){
				timePickerId = timePickerId;

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMargins
    	} 
    	 
    	View view = control.getView(inflater);
    	mRootLayout.addView(view);
    	 
    	RelativeLayout.LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
    														ViewGroup.LayoutParams.WRAP_CONTENT);
    	lp.alignWithParent = true;
    	lp.setMargins(x, y, 0, 0);
    	control.setLayoutParame(lp);
    	control.setLabel(label);
    	 
    } 
     
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMargins
    	} 
    	 
    	View view = control.getView(inflater);
    	mRootLayout.addView(view);
    	 
    	RelativeLayout.LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
    														ViewGroup.LayoutParams.WRAP_CONTENT);
    	lp.alignWithParent = true;
    	lp.setMargins(x, y, 0, 0);
    	control.setLayoutParame(lp);
    	control.setLabel(label);
    	 
    } 
     
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMargins
	private LoadFormWidget(){} 
	 
	public void getView(int choice, int integerId, int integerWidth, int integerHeight, int integerLayoutX, int integerLayoutY, String text ) {
 
		if (choice == 0) {
			params = new FrameLayout.LayoutParams(integerWidth,integerHeight);
			context = Home.getHome().getLayout().getContext();
			Button button = new Button(context);
			button.setId(integerId);
			button.setText(text);
			button.setTextColor(Color.WHITE);
			params.setMargins(integerLayoutX, integerLayoutY, 0, 0);
			button.setLayoutParams(params);
			Home.getHome().getLayout().addView(button, params);
			button.setOnTouchListener(new DragListener(button));
			if (buttonId > integerId){
				buttonId = buttonId;
			} 
			else { 
				buttonId = integerId;
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMargins
	 
	public RacingBox(Button b)
	{ 
		this.b=b;
		LinearLayout.LayoutParams params = (LayoutParams) this.b.getLayoutParams();
		params.setMargins(0, 0, 0, 0); //left, top, right, bottom
		this.b.setLayoutParams(params);
	} 
	 
	@Override 
	public void run() 
	{ 
		handler.post(timedTask);
	} 
	 
	private Runnable timedTask = new Runnable(){
 
		  @Override 
		  public void run() { 
		   // TODO Auto-generated method stub 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMargins
		@Override 
		public void onComplete() { 
			mCoverFlu = new CoverFluGL(KrocoList.this);
			parentLayout.addView(mCoverFlu, new LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
			LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,
					LayoutParams.WRAP_CONTENT);
			params.setMargins(0, 20, 0, 0);
			parentLayout.addView(txt_info, params);
			mCoverFlu.setCoverFluListener(new KrocoGLCoverGluListener());
			mCoverFlu.setSelection(0);
			mCoverFlu.setSensitivity(3.0f);
			setContentView(parentLayout);
		} 
	} 
 
	private class KrocoGLCoverGluListener implements CoverFluListener { 
 
		@Override 
		public int getCount(CoverFluGL view) {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
  @Test 
  public void testApplyBoundsToViewOnNormalProgressBar() throws Exception { 
    TabrisActivity activity = UiTestUtil.createActivityWithMockedFields();
    ProgressBarSetter<ProgressBar> setter = new ProgressBarSetter<ProgressBar>( activity );
    ProgressBar progressBar = mock( ProgressBar.class );
    MarginLayoutParams layoutParams = new MarginLayoutParams( 0, 0 );
    when( progressBar.getLayoutParams() ).thenReturn( layoutParams );
    SetProperties props = new SetProperties();
    List<Integer> bounds = Arrays.asList( 10, 20, 30, 40 );
    props.setBounds( bounds );
    UiTestUtil.mockToolkitMultiplyIdentity( activity, 10, 34, 30, 12 );
 
    setter.execute( progressBar, props );
 
    assertEquals( 10, layoutParams.leftMargin );
    assertEquals( 34, layoutParams.topMargin );
    assertEquals( 30, layoutParams.width );
    assertEquals( 12, layoutParams.height );
  } 
 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMargins
	 * @param listener 
	 */ 
	public void setPositive2Button(String text, final View.OnClickListener listener)
	{ 
		Button button=new Button(mContext);
		LinearLayout.LayoutParams params=new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
		params.setMargins(mMargins, formatDipToPx(mContext, 10), mMargins, 0);
		button.setLayoutParams(params);
		//button.setBackgroundResource(R.drawable.alertdialog_button); 
		button.setText(text);
		button.setTextColor(Color.BLACK);
		button.setTextSize(20);
		button.setOnClickListener(listener);
		mButtonLayout.addView(button, 1);
	} 
  
	/** 
	 * ���ð�ť 
	 * @param text 
	 * @param listener 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android ViewGroup.MarginLayoutParams Questions & Answers:

See Code Examples for Android ViewGroup.MarginLayoutParams Methods: