¡@

Home 

2014/10/16 ¤W¤È 08:23:42

android Programming Glossary: setlayoutparams

How to Programmatically Add Views to Views

http://stackoverflow.com/questions/2395769/how-to-programmatically-add-views-to-views

e.g. Button myButton new Button you'll need to call setLayoutParams on the newly constructed view passing in an instance of the.. R.layout.main Button myButton new Button this myButton.setLayoutParams new LinearLayout.LayoutParams LinearLayout.LayoutParams.FILL_PARENT..

Android - HorizontalScrollView within ScrollView Touch Handling

http://stackoverflow.com/questions/2646028/android-horizontalscrollview-within-scrollview-touch-handling

Context context ArrayList ListItem items super context setLayoutParams new LayoutParams LayoutParams.FILL_PARENT LayoutParams.WRAP_CONTENT.. internalWrapper new LinearLayout context internalWrapper.setLayoutParams new LayoutParams LayoutParams.FILL_PARENT LayoutParams.FILL_PARENT..

How do you setLayoutParams() for an ImageView?

http://stackoverflow.com/questions/2965662/how-do-you-setlayoutparams-for-an-imageview

do you setLayoutParams for an ImageView I want to set the LayoutParams for an ImageView.. this functionality. This code doesn't work... myImageView.setLayoutParams new ImageView.LayoutParams 30 30 How do I do it android layout.. new LinearLayout.LayoutParams 30 30 yourImageView.setLayoutParams layoutParams This is because it's the parent of the View that..

In Android, how to make space between LinearLayout children?

http://stackoverflow.com/questions/4259467/in-android-how-to-make-space-between-linearlayout-children

LayoutParams.WRAP_CONTENT params.setMargins 0 10 0 10 setLayoutParams params Edit. I also tried using MarginLayoutParams as a parameter..

Android ImageView size not scaling with source image

http://stackoverflow.com/questions/5355130/android-imageview-size-not-scaling-with-source-image

Calculations followed by calls to setMeasuredDimension setLayoutParams super.onMeasure widthMeasureSpec heightMeasureSpec So my questions..

how to display map in android with marker

http://stackoverflow.com/questions/6140433/how-to-display-map-in-android-with-marker

item MapView.addView and later updating position with setLayoutParams does the trick. private ImageView mCurrentPointer @Override.. already added just update its location mCurrentPointer.setLayoutParams lp Edited links for more examples and tutorials http mobiforge.com..

Custom tap window on Google Map

http://stackoverflow.com/questions/6385908/custom-tap-window-on-google-map

context init public void init setOrientation VERTICAL setLayoutParams new LinearLayout.LayoutParams android.view.ViewGroup.LayoutParams.FILL_PARENT..

Scale a view and its layered subviews relatively

http://stackoverflow.com/questions/6500156/scale-a-view-and-its-layered-subviews-relatively

int scale xPos animParams.topMargin int scale yPos setLayoutParams animParams Drawable dr context.getResources .getDrawable R.id.someImage..

How can I dynamically set the position of view in Android?

http://stackoverflow.com/questions/6535648/how-can-i-dynamically-set-the-position-of-view-in-android

anything below Honeycomb API Level 11 you'll have to use setLayoutParams ... . If you can limit your support to Honeycomb and up you..

Authorative way to override onMeasure()?

http://stackoverflow.com/questions/7423082/authorative-way-to-override-onmeasure

call setMeasuredDimensions followed by a call to setLayoutParams and ending with a call to super.onMeasure . For example @Override.. this.setMeasuredDimension parentWidth 2 parentHeight this.setLayoutParams new ParentLayoutType .LayoutParams parentWidth 2 parentHeight..

ObjectAnimator animate LinearLayout width

http://stackoverflow.com/questions/7902976/objectanimator-animate-linearlayout-width

params LayoutParams getLayoutParams params.weight myWidth setLayoutParams params requestLayout this.myWidth myWidth No luck. Then i tried.. params v.getLayoutParams params.width num v.setLayoutParams params return num your client code ValueAnimator.ofObject new..

SurfaceView height + width gets ignored

http://stackoverflow.com/questions/8293909/surfaceview-height-width-gets-ignored

didn't work for me when using a SurfaceView and invoking setLayoutParams ViewGroup.LayoutParams params . The below code works fine using.. videoHeight float videoWidth float screenWidth videoView.setLayoutParams video_VIEWLAYOUT My recommendation would be to try using the..

Android: Notify Scrollview that it's child's size has changed: how?

http://stackoverflow.com/questions/9993179/android-notify-scrollview-that-its-childs-size-has-changed-how

scaleFactor params.height int startY scaleFactor imageView.setLayoutParams params ... scrollView.scrollBy scrollX scrollY However no scrolling.. because the view was too small to scroll. After the setLayoutParams the view should be larger but no scrolling occurs because the.. size has changed So that scrollBy will work right after setLayoutParams on it's child android scrollview scaling share improve this..

How to Programmatically Add Views to Views

http://stackoverflow.com/questions/2395769/how-to-programmatically-add-views-to-views

that to get it to work. If you create a View via a constructor e.g. Button myButton new Button you'll need to call setLayoutParams on the newly constructed view passing in an instance of the parent view's LayoutParams inner class before you add your newly.. in your onCreate function LinearLayout myLayout findViewById R.layout.main Button myButton new Button this myButton.setLayoutParams new LinearLayout.LayoutParams LinearLayout.LayoutParams.FILL_PARENT LinearLayout.LayoutParams.FILL_PARENT myLayout.addView..

Android - HorizontalScrollView within ScrollView Touch Handling

http://stackoverflow.com/questions/2646028/android-horizontalscrollview-within-scrollview-touch-handling

300 private int activeFeature 0 public HomeFeatureLayout Context context ArrayList ListItem items super context setLayoutParams new LayoutParams LayoutParams.FILL_PARENT LayoutParams.WRAP_CONTENT setFadingEdgeLength 0 this.setHorizontalScrollBarEnabled.. false this.setVerticalScrollBarEnabled false LinearLayout internalWrapper new LinearLayout context internalWrapper.setLayoutParams new LayoutParams LayoutParams.FILL_PARENT LayoutParams.FILL_PARENT internalWrapper.setOrientation LinearLayout.HORIZONTAL..

How do you setLayoutParams() for an ImageView?

http://stackoverflow.com/questions/2965662/how-do-you-setlayoutparams-for-an-imageview

do you setLayoutParams for an ImageView I want to set the LayoutParams for an ImageView but cant seem to find out the proper way to do it. I can.. but not an ImageView . Yet the ImageView seems to have this functionality. This code doesn't work... myImageView.setLayoutParams new ImageView.LayoutParams 30 30 How do I do it android layout imageview share improve this question You need to set.. then you create a LinearLayout.LayoutParams layoutParams new LinearLayout.LayoutParams 30 30 yourImageView.setLayoutParams layoutParams This is because it's the parent of the View that needs to know what size to allocate to the View. share improve..

In Android, how to make space between LinearLayout children?

http://stackoverflow.com/questions/4259467/in-android-how-to-make-space-between-linearlayout-children

params new MarginLayoutParams LayoutParams.WRAP_CONTENT LayoutParams.WRAP_CONTENT params.setMargins 0 10 0 10 setLayoutParams params Edit. I also tried using MarginLayoutParams as a parameter while adding the views to the Linear layout as below ...

Android ImageView size not scaling with source image

http://stackoverflow.com/questions/5355130/android-imageview-size-not-scaling-with-source-image

int parentHeight MeasureSpec.getSize heightMeasureSpec Calculations followed by calls to setMeasuredDimension setLayoutParams super.onMeasure widthMeasureSpec heightMeasureSpec So my questions are 1 Can I amend the XML in some way to make it do what..

how to display map in android with marker

http://stackoverflow.com/questions/6140433/how-to-display-map-in-android-with-marker

improve this question If you're going to show just a single item MapView.addView and later updating position with setLayoutParams does the trick. private ImageView mCurrentPointer @Override public void onLocationChanged Location l int latitude int l.getLatitude.. mMapView.addView mCurrentPointer lp else If it's already added just update its location mCurrentPointer.setLayoutParams lp Edited links for more examples and tutorials http mobiforge.com developing story using google maps android http www.vogella.de..

Custom tap window on Google Map

http://stackoverflow.com/questions/6385908/custom-tap-window-on-google-map

attrs init public MapLocationViewer Context context super context init public void init setOrientation VERTICAL setLayoutParams new LinearLayout.LayoutParams android.view.ViewGroup.LayoutParams.FILL_PARENT android.view.ViewGroup.LayoutParams.FILL_PARENT..

Scale a view and its layered subviews relatively

http://stackoverflow.com/questions/6500156/scale-a-view-and-its-layered-subviews-relatively

RelativeLayout.ALIGN_PARENT_TOP animParams.leftMargin int scale xPos animParams.topMargin int scale yPos setLayoutParams animParams Drawable dr context.getResources .getDrawable R.id.someImage setBackgroundDrawable dr imgWidth dr.getIntrinsicWidth..

How can I dynamically set the position of view in Android?

http://stackoverflow.com/questions/6535648/how-can-i-dynamically-set-the-position-of-view-in-android

Me. android layout view share improve this question For anything below Honeycomb API Level 11 you'll have to use setLayoutParams ... . If you can limit your support to Honeycomb and up you can use the setX ... setY ... setLeft ... setTop ... etc. share..

Authorative way to override onMeasure()?

http://stackoverflow.com/questions/7423082/authorative-way-to-override-onmeasure

the other hand as per this post the correct way is to use MeasureSpec call setMeasuredDimensions followed by a call to setLayoutParams and ending with a call to super.onMeasure . For example @Override protected void onMeasure int widthMeasureSpec int heightMeasureSpec.. int parentHeight MeasureSpec.getSize heightMeasureSpec this.setMeasuredDimension parentWidth 2 parentHeight this.setLayoutParams new ParentLayoutType .LayoutParams parentWidth 2 parentHeight super.onMeasure widthMeasureSpec heightMeasureSpec So which..

ObjectAnimator animate LinearLayout width

http://stackoverflow.com/questions/7902976/objectanimator-animate-linearlayout-width

public void setMyWidth int myWidth LinearLayout.LayoutParams params LayoutParams getLayoutParams params.weight myWidth setLayoutParams params requestLayout this.myWidth myWidth No luck. Then i tried changing LayoutParams.width turns out width and height are.. Integer super.evaluate fraction startValue endValue ViewGroup.LayoutParams params v.getLayoutParams params.width num v.setLayoutParams params return num your client code ValueAnimator.ofObject new WidthEvaluator box box.getWidth v.getWidth .start share..

SurfaceView height + width gets ignored

http://stackoverflow.com/questions/8293909/surfaceview-height-width-gets-ignored

a similar problem when dealing with the Vitamio SDK. Resizing didn't work for me when using a SurfaceView and invoking setLayoutParams ViewGroup.LayoutParams params . The below code works fine using the standard Android media framework but importing the vitamio.. screenWidth video_VIEWLAYOUT.height int float videoHeight float videoWidth float screenWidth videoView.setLayoutParams video_VIEWLAYOUT My recommendation would be to try using the io.vov.vitamio.widget.VideoView instead of a android.view.SurfaceView..

Android: Notify Scrollview that it's child's size has changed: how?

http://stackoverflow.com/questions/9993179/android-notify-scrollview-that-its-childs-size-has-changed-how

imageView.getLayoutParams params.width int startX scaleFactor params.height int startY scaleFactor imageView.setLayoutParams params ... scrollView.scrollBy scrollX scrollY However no scrolling occurs when in the situation before the scaling scrolling.. in the situation before the scaling scrolling was not possible because the view was too small to scroll. After the setLayoutParams the view should be larger but no scrolling occurs because the scrollview thinks the child is still small. When a fes ms.. How can I notify the scrollview immediately that the child's size has changed So that scrollBy will work right after setLayoutParams on it's child android scrollview scaling share improve this question I found a solution after trying just about every..