Questions tagged [onmeasure]

77 questions
0
votes
0 answers

Android: Get dimensions of a ViewGroup in onMeasure() when set to match_parent

I've created my own ViewGroup with the aim to evenly distribute 4 elements in its area. The ViewGroup itself is set to match_parent in both width and height with a TextView above it:
henrikl
  • 479
  • 2
  • 14
0
votes
1 answer

How can MeasureSpec.getMode() extract a mode from an integer value?

I'm on chapter 4 of Professional Android 4 Application Development, and it's telling me that both a size value and a mode are extracted from the widthMeasureSpec and heightMeasureSpec values passed to the onMeasure() method of a custom view. Would…
Thomas Hodges
  • 105
  • 1
  • 10
0
votes
1 answer

Android: Listview in ScrollView with dynamic height

currently I am developing a settings menu in a scrollview. The basic structure looks like the following:
jennymo
  • 1,450
  • 1
  • 18
  • 43
0
votes
1 answer

In custom layout in onMeasure(), should textview handle its layout_height?

I have a custom layout that includes some TextView and other widgets. The TextViews have an XML attribute android:layout_height="". The problem is that the layout_height is being ignored and, I think, treated as wrap_content. I thought that the…
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101
0
votes
1 answer

Android - delayed setImage on list item causes the onMeasure to be invoked and hence to repaint everything from position 0

I have a listview showing rows containing images from the web. once a row needs to be drawn, in Adapter.getView(...), I download the image in the background and set it to the ImageView in the UI thread. This means that the bitmap is being set into…
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
0
votes
1 answer

android layout with aspect ratio cant show childs which refers to parent

im trying to make a RelativeLayout with aspect ratio 2:1. Layout is resizing properly and also ImageView in this RelativeLayout looks good. But TextView isnt visible, and that is because of attribute android:layout_centerInParent="true" Using any…
kort.es
  • 479
  • 2
  • 7
  • 26
0
votes
3 answers

How can I invoke onMeasure method? - Android

I have one activity with one view. The purpose of this view is to show a squared grid. The square sides will equal to the screen width divided by the number of squares that exist horizontally. @Override protected void onCreate(Bundle…
Bruno Tavares
  • 450
  • 1
  • 4
  • 18
0
votes
0 answers

Weird issue in custom view onMeasure

I have a custom view extended from RelativeLayout where the size should be square, and a background image with match_parent for it's width and height as it's child. There is also a button that should be centered horizontally and aligned with the…
0
votes
1 answer

android - custom view has width and height of 0

I'm trying to create a custom view with two TextViews inside a vertical LinearLayout, but am totally confused as to how it all works. Currently nothing is appearing as I my onDraw method isn't being called. I think this is due to the fact that my…
Russ Wheeler
  • 2,590
  • 5
  • 30
  • 57
0
votes
1 answer

Interrupting the onMeasure cycle to display an error (Android)

I've overriden the getView(int, View, ViewGroup) method of View to provide some custom behaviour and I'd like to be able to abort the recursive measure() -> onMeasure() -> measureChildStuff() -> child.measure() if an error occurrs during my custom…
Eric Dand
  • 1,106
  • 13
  • 37
0
votes
1 answer

Custom layout just to override onMeasure()

I want to use my custom layout that extends the LinearLayout class and overrides the onMeasure() method like this :
ChAndroid
  • 35
  • 8
0
votes
1 answer

Where is the onMeasure() default code located?

I understand that you can override the onMeasure() method to make custom measurements and that the onMeasure() method is called when you call the view.measure() method If I call view.measure as shown below, it will still work even if I don't…
Kevik
  • 9,181
  • 19
  • 92
  • 148
0
votes
1 answer

Dynamically resize relative layout

I'm trying to create something that looks like this. I can sort of get the header working, and the word cloud look-alike stuff on the right. I'm calling it from a Fragment. But I'm struggling to get the two column thing working. I tried to get the…
Merelda
  • 1,318
  • 2
  • 12
  • 26
0
votes
1 answer

Resize view while ActionBar slide up animation is running

I have an ImageView inside an activity and when the user clicks on it, I animate the view height so it becomes fullscreen (other views are just become hidden below the bottom of the screen). However once the animation is finished I hide the…
qwertzguy
  • 15,699
  • 9
  • 63
  • 66
0
votes
1 answer

Custom Button background is being drawn wrong (sometimes)

I have this custom button, which does not draw himself and has no child views. Right after app launch it looks like this: At this point I don't know what code and details might be relevant for posting here. The fact is after the app changes state…
ilomambo
  • 8,290
  • 12
  • 57
  • 106