android Programming Glossary: getheight
How to get screen dimensions http://stackoverflow.com/questions/1016896/how-to-get-screen-dimensions introduced in API level 13 you could use the getWidth and getHeight methods that are now deprecated Display display getWindowManager.. int width display.getWidth deprecated int height display.getHeight deprecated For the use case you're describing however a margin..
Android ICS and MJPEG using AsyncTask http://stackoverflow.com/questions/10550139/android-ics-and-mjpeg-using-asynctask bm mIn.readMjpegFrame destRect destRect bm.getWidth bm.getHeight c.drawColor Color.BLACK c.drawBitmap bm null destRect p.. null height ovlPos 1 1 destRect.top destRect.bottom ovl.getHeight width ovlPos 8 8 destRect.left destRect.right ovl.getWidth.. MjpegView.SIZE_STANDARD dispWidth getWidth dispHeight getHeight public void startPlayback if mIn null mRun true thread.start..
Vertical (rotated) label in Android http://stackoverflow.com/questions/1258275/vertical-rotated-label-in-android public void draw Canvas canvas if topDown canvas.translate getHeight 0 canvas.rotate 90 else canvas.translate 0 getWidth canvas.rotate.. 0 getWidth canvas.rotate 90 canvas.clipRect 0 0 getWidth getHeight android.graphics.Region.Op.REPLACE super.draw canvas By default.. getWidth 0 canvas.rotate 90 else canvas.translate 0 getHeight canvas.rotate 90 canvas.translate getCompoundPaddingLeft getExtendedPaddingTop..
Android and MJPEG http://stackoverflow.com/questions/3205191/android-and-mjpeg bm mIn.readMjpegFrame destRect destRect bm.getWidth bm.getHeight c.drawColor Color.BLACK c.drawBitmap bm null destRect p.. null height ovlPos 1 1 destRect.top destRect.bottom ovl.getHeight width ovlPos 8 8 destRect.left destRect.right ovl.getWidth.. MjpegView.SIZE_STANDARD dispWidth getWidth dispHeight getHeight public void startPlayback if mIn null mRun true thread.start..
Determining the size of an Android view at runtime http://stackoverflow.com/questions/3779173/determining-the-size-of-an-android-view-at-runtime R.id.MyViewID This works fine but when calling getWidth getHeight getMeasuredWidth getLayoutParams .width etc. they all return.. first layout. Only after the first layout will getWidth getHeight getMeasuredWidth getMeasuredHeight work. ViewTreeObserver viewTreeObserver..
How do you to retrieve dimensions of a view? Getheight() and Getwidth() always return zero http://stackoverflow.com/questions/4142090/how-do-you-to-retrieve-dimensions-of-a-view-getheight-and-getwidth-always-r R.id.board tl TableLayout findViewById R.id.board vh tl.getHeight getHeight returned 0 Why vw tl.getWidth getWidth returned 0.. tl TableLayout findViewById R.id.board vh tl.getHeight getHeight returned 0 Why vw tl.getWidth getWidth returned 0 Why Test 2.. tv new TextView this tv.setHeight 20 tv.setWidth 20 vh tv.getHeight getHeight returned 0 Why vw tv.getWidth getWidth returned 0..
How can I get a working vertical SeekBar in Android? http://stackoverflow.com/questions/4892179/how-can-i-get-a-working-vertical-seekbar-in-android protected void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c @Override public boolean onTouchEvent MotionEvent.. setProgress getMax int getMax event.getY getHeight onSizeChanged getWidth getHeight 0 0 break case MotionEvent.ACTION_CANCEL.. int getMax event.getY getHeight onSizeChanged getWidth getHeight 0 0 break case MotionEvent.ACTION_CANCEL break return true..
Auto Scale TextView Text to Fit within Bounds http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds wrapping text in a TextView so that it will fit within its getHeight and getWidth bounds. I'm not simply looking for a way to wrap.. way to auto resize a textview to fit wrapped in its getHeight and getWidth bounds Thanks to everyone who shared what they.. width and height public void resizeText int heightLimit getHeight getPaddingBottom getPaddingTop int widthLimit getWidth getPaddingLeft..
Rotate zoom drag image in android imageview http://stackoverflow.com/questions/5894736/rotate-zoom-drag-image-in-android-imageview savedValue int width getWidth int height getHeight Drawable d getDrawable if d null return int imageWidth d.getIntrinsicWidth..
Modifying the Android seekbar widget to operate vertically http://stackoverflow.com/questions/631238/modifying-the-android-seekbar-widget-to-operate-vertically protected void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c private OnSeekBarChangeListener onChangeListener.. event int progress getMax int getMax event.getY getHeight Ensure progress stays within boundaries of the seekbar if progress.. this progress true onSizeChanged getWidth getHeight 0 0 onChangeListener.onProgressChanged this getMax int getMax..
Android imageView Zoom-in and Zoom-Out http://stackoverflow.com/questions/6650398/android-imageview-zoom-in-and-zoom-out is very important image.setBounds getWidth 2 zoomControler getHeight 2 zoomControler getWidth 2 zoomControler getHeight 2 zoomControler.. getHeight 2 zoomControler getWidth 2 zoomControler getHeight 2 zoomControler image.draw canvas @Override public boolean onKeyDown..
How to get screen dimensions http://stackoverflow.com/questions/1016896/how-to-get-screen-dimensions Display display wm.getDefaultDisplay Before getSize was introduced in API level 13 you could use the getWidth and getHeight methods that are now deprecated Display display getWindowManager .getDefaultDisplay int width display.getWidth deprecated.. Display display getWindowManager .getDefaultDisplay int width display.getWidth deprecated int height display.getHeight deprecated For the use case you're describing however a margin padding in the layout seems more appropriate. share improve..
Android ICS and MJPEG using AsyncTask http://stackoverflow.com/questions/10550139/android-ics-and-mjpeg-using-asynctask synchronized mSurfaceHolder try bm mIn.readMjpegFrame destRect destRect bm.getWidth bm.getHeight c.drawColor Color.BLACK c.drawBitmap bm null destRect p if showFps p.setXfermode mode if ovl null height ovlPos.. null destRect p if showFps p.setXfermode mode if ovl null height ovlPos 1 1 destRect.top destRect.bottom ovl.getHeight width ovlPos 8 8 destRect.left destRect.right ovl.getWidth c.drawBitmap ovl width height null p.setXfermode null.. Color.BLACK ovlPos MjpegView.POSITION_LOWER_RIGHT displayMode MjpegView.SIZE_STANDARD dispWidth getWidth dispHeight getHeight public void startPlayback if mIn null mRun true thread.start public void stopPlayback mRun false boolean retry true while..
Vertical (rotated) label in Android http://stackoverflow.com/questions/1258275/vertical-rotated-label-in-android int r int b return super.setFrame l t l b t t r l @Override public void draw Canvas canvas if topDown canvas.translate getHeight 0 canvas.rotate 90 else canvas.translate 0 getWidth canvas.rotate 90 canvas.clipRect 0 0 getWidth getHeight android.graphics.Region.Op.REPLACE.. getHeight 0 canvas.rotate 90 else canvas.translate 0 getWidth canvas.rotate 90 canvas.clipRect 0 0 getWidth getHeight android.graphics.Region.Op.REPLACE super.draw canvas By default rotated text is from top to bottom. If you set android.. getDrawableState canvas.save if topDown canvas.translate getWidth 0 canvas.rotate 90 else canvas.translate 0 getHeight canvas.rotate 90 canvas.translate getCompoundPaddingLeft getExtendedPaddingTop getLayout .draw canvas canvas.restore ..
Android and MJPEG http://stackoverflow.com/questions/3205191/android-and-mjpeg synchronized mSurfaceHolder try bm mIn.readMjpegFrame destRect destRect bm.getWidth bm.getHeight c.drawColor Color.BLACK c.drawBitmap bm null destRect p if showFps p.setXfermode mode if ovl null height ovlPos.. null destRect p if showFps p.setXfermode mode if ovl null height ovlPos 1 1 destRect.top destRect.bottom ovl.getHeight width ovlPos 8 8 destRect.left destRect.right ovl.getWidth c.drawBitmap ovl width height null p.setXfermode null.. Color.BLACK ovlPos MjpegView.POSITION_LOWER_RIGHT displayMode MjpegView.SIZE_STANDARD dispWidth getWidth dispHeight getHeight public void startPlayback if mIn null mRun true thread.start public void stopPlayback mRun false boolean retry true while..
Determining the size of an Android view at runtime http://stackoverflow.com/questions/3779173/determining-the-size-of-an-android-view-at-runtime my view by ImageView myView ImageView getWindow .findViewById R.id.MyViewID This works fine but when calling getWidth getHeight getMeasuredWidth getLayoutParams .width etc. they all return 0. I have also tried manually calling measure on the view followed.. Use the ViewTreeObserver on the View to wait for the first layout. Only after the first layout will getWidth getHeight getMeasuredWidth getMeasuredHeight work. ViewTreeObserver viewTreeObserver view.getViewTreeObserver if viewTreeObserver.isAlive..
How do you to retrieve dimensions of a view? Getheight() and Getwidth() always return zero http://stackoverflow.com/questions/4142090/how-do-you-to-retrieve-dimensions-of-a-view-getheight-and-getwidth-always-r on the screen TableLayout tl TableLayout findViewById R.id.board tl TableLayout findViewById R.id.board vh tl.getHeight getHeight returned 0 Why vw tl.getWidth getWidth returned 0 Why Test 2 used a simple dynamically generated view TextView.. the screen TableLayout tl TableLayout findViewById R.id.board tl TableLayout findViewById R.id.board vh tl.getHeight getHeight returned 0 Why vw tl.getWidth getWidth returned 0 Why Test 2 used a simple dynamically generated view TextView tv new TextView.. Test 2 used a simple dynamically generated view TextView tv new TextView this tv.setHeight 20 tv.setWidth 20 vh tv.getHeight getHeight returned 0 Why vw tv.getWidth getWidth returned 0 Why eof method eof class android layout android widget lifecycle..
How can I get a working vertical SeekBar in Android? http://stackoverflow.com/questions/4892179/how-can-i-get-a-working-vertical-seekbar-in-android setMeasuredDimension getMeasuredHeight getMeasuredWidth protected void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c @Override public boolean onTouchEvent MotionEvent event if isEnabled return false switch event.getAction.. case MotionEvent.ACTION_MOVE case MotionEvent.ACTION_UP setProgress getMax int getMax event.getY getHeight onSizeChanged getWidth getHeight 0 0 break case MotionEvent.ACTION_CANCEL break return true To implement it create.. case MotionEvent.ACTION_UP setProgress getMax int getMax event.getY getHeight onSizeChanged getWidth getHeight 0 0 break case MotionEvent.ACTION_CANCEL break return true To implement it create a new class in your project choosing..
Auto Scale TextView Text to Fit within Bounds http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds Fit within Bounds I'm looking for an optimal way to resize wrapping text in a TextView so that it will fit within its getHeight and getWidth bounds. I'm not simply looking for a way to wrap the text I want to make sure it both wraps and is small enough.. whether text will be small enough tl dr is there a best practice way to auto resize a textview to fit wrapped in its getHeight and getWidth bounds Thanks to everyone who shared what they had I recommend Chase's solution for most cases and I've listed.. left top right bottom Resize the text size with default width and height public void resizeText int heightLimit getHeight getPaddingBottom getPaddingTop int widthLimit getWidth getPaddingLeft getPaddingRight resizeText widthLimit heightLimit..
Rotate zoom drag image in android imageview http://stackoverflow.com/questions/5894736/rotate-zoom-drag-image-in-android-imageview 9 matrix.getValues value float savedValue new float 9 savedMatrix2.getValues savedValue int width getWidth int height getHeight Drawable d getDrawable if d null return int imageWidth d.getIntrinsicWidth int imageHeight d.getIntrinsicHeight int scaleWidth..
Modifying the Android seekbar widget to operate vertically http://stackoverflow.com/questions/631238/modifying-the-android-seekbar-widget-to-operate-vertically setMeasuredDimension getMeasuredHeight getMeasuredWidth protected void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c private OnSeekBarChangeListener onChangeListener @Override public void setOnSeekBarChangeListener OnSeekBarChangeListener.. the super seems to help fix drawing problems super.onTouchEvent event int progress getMax int getMax event.getY getHeight Ensure progress stays within boundaries of the seekbar if progress 0 progress 0 if progress getMax progress getMax Draw.. lastProgress lastProgress progress onChangeListener.onProgressChanged this progress true onSizeChanged getWidth getHeight 0 0 onChangeListener.onProgressChanged this getMax int getMax event.getY getHeight true setPressed true setSelected true..
Android imageView Zoom-in and Zoom-Out http://stackoverflow.com/questions/6650398/android-imageview-zoom-in-and-zoom-out the width and height of the images........ this line is very important image.setBounds getWidth 2 zoomControler getHeight 2 zoomControler getWidth 2 zoomControler getHeight 2 zoomControler image.draw canvas @Override public boolean onKeyDown.. line is very important image.setBounds getWidth 2 zoomControler getHeight 2 zoomControler getWidth 2 zoomControler getHeight 2 zoomControler image.draw canvas @Override public boolean onKeyDown int keyCode KeyEvent event if keyCode KeyEvent.KEYCODE_DPAD_UP..
|