Questions tagged [onmeasure]
77 questions
1
vote
0 answers
(Android or AndroidTV) When we set setMeasuredDimension with (1,1), we got the black screen
I had some problem.
When we set the setMeasuredDimension with (1,1), it makes blackscreen. (I'm looking for the behind view. But when we set (1,1) screen change to the black)
In case I set the setMeasuredDimension with (2,2), it's operation has no…

최상욱
- 11
- 2
1
vote
1 answer
Custom font causing my dynamic ViewPager's OnMeasure to cut off lines of text
So my custom TextView is cutting off the last line of text in some cases. I'm using a custom font. It seems to only cut off the last word. I changed my custom text views to regular ones, which forces my text views to use standard fonts instead of my…

Zeek Aran
- 523
- 4
- 18
1
vote
0 answers
Understanding onMeasure implementation in ViewPager
I was going through the code of ViewPager for some unrelated reason and I saw that it overrides onMeasure of ViewGroup. I've been trying to learn how to properly implement onMeasure so I decided to take a closer look. Here's the method for…

Kanj
- 380
- 3
- 8
1
vote
1 answer
TextView is not rendered when added in separate layout in OnMeasure override method in Xamarin.Android
I have following classes
TextLayout class, in which I have created a single textview and added it in onMeasure override method.
public class TextLayout : FrameLayout
{
private TextView headerLabel;
public TextLayout(Context context) :…

Swathi Gopal
- 103
- 1
- 7
1
vote
2 answers
Android: java.lang.ClassCastException: com.android.layoutlib.bridge.android.BridgeContext cannot be cast to android.app.Activity"
These are the problem in details :
java.lang.ClassCastException: com.android.layoutlib.bridge.android.BridgeContext cannot be cast to android.app.Activity
at io.jchat.android.view.LoginView.onMeasure_Original(LoginView.java:123);
at…

xuange
- 57
- 1
- 10
1
vote
1 answer
Android: How to change the size of a GradientDrawable within a layer-list programmatically
I have a layer-list within a file layers.xml:
-

Caro
- 35
- 2
- 7
1
vote
2 answers
setGravity after setMeasuredDimension is not work
I created class customTextView extent TextView
and I set textAlignment to center.
In onMeasure I changed the textview width.
After that textview align change to left
and I used this.setGravity(Gravity.CENTER_VERTICAL |…

reza malekmohamadi
- 507
- 1
- 8
- 14
1
vote
0 answers
Scrollview FillViewport Scrolling not working (MPAndroidChart)
Goal: Multiple Charts in a Scrollview (First just vertical scrollable, but preferred in a Gridview with 2 columns)
Problem: Vertical Scrolling is not working
Hint: The sizing of charts (with onMeasure) and fillViewport = true works
Tried much…

Malte
- 51
- 1
- 10
1
vote
1 answer
Getting Total Height of RecyclerView
I'm Trying to get total height of RecyclerView to assign it to it's parent in a Dialog to wrap it.
I try this way to get it:
private int getTotalHeightOfRecyclerView(RecyclerView recyclerView){
int totalHeight = 0;
int totalCount …

MAY3AM
- 1,182
- 3
- 17
- 42
1
vote
1 answer
ListView inside ScrollView with Auto Adjust Height
I try to create a ListView Inside ScrollView with EdiText inside the ListView. So I use a Custom method to make my ListView NonScrollable.
My ListView Item xml is like this:

Dirus
- 1,033
- 2
- 14
- 21
1
vote
1 answer
How to get custom View's width when layout_width is wrap_content?
Let's say we have our custom View declared in XML and we override its onMeasure() method:
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Maximal length of line is width of this View
width =…

Axel Stone
- 1,521
- 4
- 23
- 43
1
vote
0 answers
Custom View Wrap content override OnMeasure
I have created a custom view in which a bitmap is drawn. The problem is that the custom view takes up the whole screen regardless of the layout width/height I set it or it's parent.
I have been going through the forums and I read about overriding…

DJ-DOO
- 4,545
- 15
- 58
- 98
1
vote
0 answers
Overriding OnMeasure
I made a custom view with the following xml

sean
- 717
- 2
- 9
- 23
1
vote
1 answer
onMeasure from View yielding 0 in my Activity
The application runs. What it is supposed to do is display "=Heightofthescreen=" in a textbox where Heightofthescreen is the actual value of the screen. Instead, however, it just gives me a 0. I imagine it is something with my context but I don't…

user2957243
- 15
- 3
0
votes
0 answers
GridView doesn't render in different situations
I have problem with my GridView. I used it for displaying list of images and adding new to the list. When I start with empty list, everything works perfectly, but if i load images from cache folder, everything stays the same except that GridView has…

Artemiy Zubarev
- 1
- 1