Linked Questions

7 votes
1 answer
15k views

Here is my layout.I need to get the width in CategoryFragment. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:...
Folyd's user avatar
  • 1,145
4 votes
4 answers
2k views

I'm trying to learn the basics of android and when I call RelativeLayout.getWidth I get 0 as a value instead of the expected size of the layout. I have a RelativeLayout filling my screen: <...
Slamit's user avatar
  • 563
0 votes
1 answer
629 views

I have this code : @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); content = (RelativeLayout) ...
Кристиян Кацаров's user avatar
2 votes
0 answers
141 views

I'm trying to verify the position of a View on screen but View.getTop or View.getLocationOnScreen() will always return 0. View.getHeight() is greater than 0 and appears to be correct. Is this a ...
Ljdawson's user avatar
  • 12.3k
0 votes
1 answer
94 views

When Activity onResume() is called, it indicates that the app is in the foreground, is visible, and is in a state of interacting with the user. However, when the method is executed for the first time, ...
Zero's user avatar
  • 59
0 votes
1 answer
78 views

I am trying to pass in view height as a max value for an animation inside onCreate to a custom gesture listener: @Override protected void onCreate(Bundle savedInstanceState) { ...
Mehdi Haghgoo's user avatar
504 votes
8 answers
342k views

In the viewpoint of running code in the UI thread, is there any difference between: MainActivity.this.runOnUiThread(new Runnable() { public void run() { Log.d("UI thread", "I am the UI ...
Luky's user avatar
  • 5,406
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
71 votes
6 answers
61k views

I'm building a UI, and it's all static defined in the XML. All of it has weights all over the place, and while it looks right, I wanted to see that things actually have the right height and all. The ...
Alex B's user avatar
  • 1,575
30 votes
4 answers
87k views

I am working on a screen which contains Three tabs I am trying to add an icon with My text in tabs and i want the image to be upper the text and there should be some space between them it is my code. ...
Mahmoud Ahmed's user avatar
27 votes
2 answers
31k views

This is the code what i am using... <TextView android:id="@+id/textView" android:layout_width="100dp" android:layout_height="40dp" android:text="AMIT KUMAR" /> and here is a ...
AMIT's user avatar
  • 400
23 votes
8 answers
49k views

I have looked at the similar questions and tried their solutions, but it didn't work for me. I'm trying to read width of an imageView, but it is returning 0. Here is the code: public class ...
yrazlik's user avatar
  • 10.8k
26 votes
6 answers
24k views

I'm looking for a good way to measure the dimensions of the actual content area for an activity in Android. Getting display always works. Simply go like this: Display display = getWindowManager()....
JMRboosties's user avatar
  • 15.8k
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
18 votes
2 answers
38k views

I am trying to set the position of the horizontal scrollview so it corresponds with the button that is pushed. I've tried using this to set it unsuccessfully: HorizontalScrollView hsv = (...
Nick's user avatar
  • 9,393

15 30 50 per page
1
2 3 4 5
8