Linked Questions

0 votes
3 answers
951 views

I am new in android. My program has setContentView(R.layout.popup). The xml file contains a button. I need the position of the button. For this I am using btn_obj.getX but it returns 0. I think I am ...
JithinMechery's user avatar
1 vote
1 answer
1k views

I am using the sample code in this question(getWidth() and getHeight() of View returns 0). It had the following code, view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver....
Damn Vegetables's user avatar
0 votes
1 answer
2k views

I want to make a method that computes the margin values based on the parent's height and width. The code below outputs -1 for both height and width. How can I get the parent's height and width ...
Orl13's user avatar
  • 584
-1 votes
1 answer
1k views

I want to check if soft keyboard is visible on screen. For that I found a code and tried it as given . But both activityRootView.getRootView().getHeight() and activityRootView.getHeight() returns ...
user177913's user avatar
1 vote
3 answers
963 views

private void getPicDetails() { targetW = img_cow.getWidth(); targetH = img_cow.getHeight(); Log.e("targetW: ", "" + targetW); Log.e("targetH: ", "" + ...
Operative's user avatar
  • 149
-1 votes
1 answer
2k views

I am trying to declare and initialize a variable globally as final, this variable should holde thewidth and the height of an element in the drawable, how to achieve that. I want smothing like the ...
Amrmsmb's user avatar
  • 11.6k
6 votes
0 answers
1k views

When a view inside a ConstraintLayout is set up with android:layout_width="0dp" and android:layout_height="0dp" so that the constraints set in app:layout_constraintLeft_toLeftOfand the likes are ...
ema3272's user avatar
  • 1,051
2 votes
3 answers
1k views

I'm new to android development and I'm facing a small difficulty regarding the GridView. I have a Gridview in my first class called Game and I added a BaseAdapter called GameAdapter. The code is ...
user3396919's user avatar
1 vote
1 answer
1k views

Writing an Android app in Android Studio, I've got a GridView to display a set of images / text and I'm having trouble working out how to access a specific item within the list. If I tap on an item, ...
Quentin's user avatar
  • 49
1 vote
5 answers
611 views

I divide the main layout to 4 sections. First part is a image view that has the layout_weight="2" and two linear layouts with the layout_weight="1" for each one. in every linear layouts there are 2 ...
Ehsan Toghian's user avatar
0 votes
1 answer
2k views

I'm inflating a ViewGroup for export into a PDF document. After inflating it from xml file I am filling it with images and texts. Now when I try to draw this ViewGroup in the canvas of a PDF page, the ...
rommex's user avatar
  • 758
0 votes
2 answers
938 views

I have a TextView with multiple lines. How can I determine the space at the end to know if a view fits in there? Example: -------------------- | I am a multiline | | text that has | | space at ...
shilch's user avatar
  • 2,075
0 votes
2 answers
864 views

I have a Class called LineGraphView which is a subclass of View. I want to be able to pass some data to this view so that it can then draw accordingly in its onDraw() method. Analysis Fragment (Where ...
StuStirling's user avatar
  • 16.3k
0 votes
2 answers
676 views

My imageView in xml: <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/ivManagePhoto" ...
romanPotapskyi's user avatar
1 vote
1 answer
679 views

I has constraint layout with ImageView inside it: <ImageView android:id="@+id/iv_lottery" android:layout_width="0dp" android:layout_height="wrap_content" android:...
igor_rb's user avatar
  • 1,891

15 30 50 per page
1 2 3
4
5
8