Questions tagged [onmeasure]
77 questions
0
votes
1 answer
Custom control takes full space while setting Height as Auto in row definition
I tried to return the same size in the OnMeasure method. If I set the RowDefinition value as auto for my custom control, the custom control renders in the next row definition space also.
The custom control renders in 3 and 4 rows and the 4th-row…

Santhiya
- 191
- 2
- 14
0
votes
1 answer
Adding a Progress Bar to a loading image
I am trying to create a progress bar that will display while an image is downloading from a server. This image is loaded into a custom view. (I need it to be custom because I draw on the image.)
My solution was to add the custom view into the XML…

chrisdottel
- 1,053
- 1
- 12
- 21
0
votes
0 answers
ViewPager lags onMeasure
When ViewPager has 3 pages it works ok, but when pages count becomes about 10 app lags. Each page has nested custom views
Logs saying:
onMeasure time too long, this =android.support.v4.view.ViewPager...
Why it happens depends on pages count?…

sedq
- 305
- 2
- 11
0
votes
0 answers
Is it correct to work with the width and height parameters after making the setMeasuredDimension call?
I created a custom view in which I want to draw a series of squares, the side of the square depends on the dimensions that are assigned to the view, so in my method onMeasure() after checking mode and size, I call setMeasuredDimension (width,…

JayJona
- 469
- 1
- 16
- 41
0
votes
1 answer
why is @SuppressLint("WrongCall") required only after method extraction
I have this andorid code:
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
//some code
…

Elad Benda
- 35,076
- 87
- 265
- 471
0
votes
1 answer
Android Swipe menu on list item can't handle parent width changes
I am trying to create a swipe menu for my items in recyclerview and ended up implemeting the library: https://github.com/chthai64/SwipeRevealLayout
At first look at it after implementing it, I thought it was working. But for some reason, it does not…

Langkiller
- 3,377
- 13
- 43
- 72
0
votes
1 answer
strange onMeasure() behavior
I have a complex layout which contains following view:

undefined
- 623
- 7
- 27
0
votes
2 answers
Custom view on measure not working as expected
I am creating a custom TextView which can draw text at both ends like this,and this supports multiline, so that the number of text views can be cut down to half(I got a lint warning, complaining about 80+ views, and most of the views are TextViews…

Sony
- 7,136
- 5
- 45
- 68
0
votes
0 answers
Android View: onMeasure() onLayout() onDraw() how to limit calls
I am really curious how to limit the calls of these methods onMeasure(), onLayout(), onDraw(). Since I know they are called everytime the View need to resize if any other View is being added. Am I thinking right? I want to know how to avoid checking…

shurrok
- 795
- 2
- 13
- 43
0
votes
1 answer
onMeasure call to getMeasuredWidth or Height return 0 for children
I'm trying to dynamically add items to the my CustomView and make the final height the size of all the children added together. The only problem is the child.getMeasuredHeight or child.getMeasuredWidth always returns a value of 0 during run time.…

AConsiglio
- 256
- 1
- 3
- 13
0
votes
1 answer
Android View resize and WindowManager: unwanted transition during child view placement
I'm having some problems in avoiding an unwanted transition during child view placement in a custom ViewGroup after parent view resizing. This problem seems to be only present when using the WindowManager instead of the call to setContentView().…

Christopher23
- 126
- 8
0
votes
1 answer
How to get Custom ViewGroup height in onMeasure
This is onMeasure() on CustomView which extend FrameLayout. After investigate onMeasure(), heigh size is always zero. How could I know what is the height size of this CustomView to manipulate child view later.
@Override
protected void…

Jongz Puangput
- 5,527
- 10
- 58
- 96
0
votes
1 answer
How to redraw a customized view in onResume?
I have made a customized imageview with some editing for length and height size in onMeasure() in the view class. I have set this content in onCreate method of my Main Activity, but such changes didn't apply to my imageview.
Is there any solution…

LunarS
- 95
- 2
- 10
0
votes
2 answers
Extending a view which overrides onMeasure()
I have a view view1 which extends FrameLayout and overrides onMeasure() like this, so that it is rendered as a square:
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec,…

Aakash Anuj
- 3,773
- 7
- 35
- 47
0
votes
1 answer
Set size of custom view
I'm creating a custom view. In onDraw method I draw a bitmap. The Bitmaps can have a different height. I need to set the height of view after the picture is loaded. I got onMeasure and onDraw in the logs. onMeasure is called before onDraw. In…

Mansur Nashaev
- 293
- 1
- 5
- 15