Linked Questions

6 votes
2 answers
18k views

I've create a custom view based on LinearLayout and I need to calculate the layout width and height according to the parent view but each time I use ((View)this.getParent()).getMeasuredWidth() I got 0 ...
iSun's user avatar
  • 1,752
3 votes
2 answers
4k views

I have a unknown number of TextView elements some EditText elements and so on, that are all placed in one linear layout... And I want to calculate the height of the layout at run time so I can get the ...
Lukap's user avatar
  • 32.1k
0 votes
1 answer
152 views

I have an EditText that has a start and end constraint in a Constraint Layout, along with a width that is declared with a "0dp" in the XML. I am trying to figure out how to obtain the width of the ...
soapie's user avatar
  • 3
388 votes
23 answers
470k views

What's the height of the status bar in Android? Is it always the same? From my measurements it seems that it's 25dp, but I'm not sure if it has the same height on all platforms. (I want to know this ...
hpique's user avatar
  • 121k
91 votes
19 answers
154k views

I have designed an layout in which LinearLayout has 2 children LinearLayout and FrameLayout and in each child I put different views. I just wanted to measure height and width of FrameLayout so that I ...
Rohit's user avatar
  • 2,680
81 votes
14 answers
80k views

How would I extend TextView to allow the drawing of text with a gradient effect?
Casebash's user avatar
  • 120k
129 votes
5 answers
186k views

Recently, I read these posts: Android Design Support Library Android Support Library, revision 22.2.0 FloatingActionButton But, none of them give me a detail example about creating a new ...
Anggrayudi H's user avatar
  • 15.2k
77 votes
5 answers
48k views

I have to use an OnGlobalLayoutListener object and then to remove the listener, I had a problem with deprecated methods that I resolve with following code. protected void onCreate(Bundle ...
crbin1's user avatar
  • 2,229
41 votes
7 answers
36k views

If I call getMeasuredWidth() or getWidth() for layout in onResume they returns 0. I think that view it's not drawn yet in this moment. Also I think that I need to put getMeasuredWidth() or getWidth()...
mobiledev Alex's user avatar
47 votes
7 answers
33k views

How can I get the number of lines a string will take up in a TextView before it is rendered. A ViewTreeObserver will not work because those are only fired after it is rendered.
Nandha's user avatar
  • 6,776
23 votes
1 answer
12k views

I'm trying to dynamically adjust the height of my rows depending on the (screen height - my layout height) / list.size. Unfortunately in the onCreate method the layout height returns null (not so ...
Chr0n's user avatar
  • 231
16 votes
5 answers
30k views

When I use the GlobalLayoutListener to see if the softKeyboard is opened or not the fragment is not garbageCollected anymore after it is destroyed. What I do: I remove the Listener in the onDestroy() ...
marcel12345689's user avatar
9 votes
5 answers
18k views

I am adding an adMob banner to my app successfully. When banner appears I need to get its height in order to resize all layout elements. I am using the event onReceivedAd, that is properly fired. ...
Jaume's user avatar
  • 3,830
10 votes
3 answers
8k views

I have created a draggable view inside RelativeLayout. But it seems to go beyond the RelativeLayout. I simply want to make a View draggable inside ViewGroup And this view is draggable according to ...
Zar E Ahmer's user avatar
  • 34.5k
7 votes
4 answers
2k views

Given any shape (either filled circle, star, triangle, bitmap with transparent areas, etc.) I would like to know if it's possible (using the latest Android API) to know if the user has clicked on the ...
android developer's user avatar

15 30 50 per page