Questions tagged [gravity]

The concept of UI widgets being dragged to a specific side of a surrounding element.

The concept of UI widgets being dragged to a specific side of a surrounding element.

Do not use this to refer to accelerometers (gravity sensors) in mobile phones. Use accelerometer instead.

832 questions
17
votes
7 answers

Android : Align a text at left and center the textview in his parents view

Hello i'm facing a little problem I'm using GRAVITY LEFT to make my text an aligment for the left side of a view but I want to center inside the textview but also align on the left part Here's what I have now: …
Foushi
  • 365
  • 1
  • 3
  • 12
17
votes
3 answers

What is exact difference between gravity and layout_gravity

Possible Duplicate: Android - gravity and layout_gravity I have been working on android xml's. I have used android:layout_gravity="center" to align components in specific position. Now a days, when I was working on a Dialog like Activity, I came…
Sahil Mahajan Mj
  • 11,033
  • 8
  • 53
  • 100
16
votes
4 answers

RelativeLayout gravity center not working

I'm trying to horizontally center several views in a RelativeLayout that is a base.
Frank Sposaro
  • 8,511
  • 4
  • 43
  • 64
15
votes
5 answers

Android image view gravity

How can I dynamically set the gravity ? Bitmap bmp; im = new ImageView (this); bmp=getbmp(img); im.setImageBitmap(bmp); Now I would like to put the image in the top . Ho can I do this without android:gravity in main.xml ? EDIT : main.xml
Teo
  • 3,394
  • 11
  • 43
  • 73
15
votes
5 answers

Collisions between game objects and the floor with regards to gravity?

How do games with gravity handle the relationship between moving things like players, monsters, or objects and the floor? Is the player constantly "falling into" the floor and being bounced back up? Two ways to react to collisions that I have…
Andru Luvisi
  • 24,367
  • 6
  • 53
  • 66
15
votes
2 answers

2D orbital physics

I'm working on a 2D physics engine for a game. I have gravity and masses working, using a simple iterative approach (that I know I'll have to upgrade eventually); I can push the masses around manually and watch them move and it all works as I'd…
David Given
  • 13,277
  • 9
  • 76
  • 123
13
votes
2 answers

How to set different gravity for TextInputLayout's hint and text in Android

How to set different gravity for TextInputLayout's hint and text entered in edit text. I want to set the hint gravity to start and edit text's text gravity to center. So how can i achieve this. This is my xml code, …
13
votes
8 answers

How to remove space on the left side of Android searchview (which is not part of actionbar)?

I am using a searchview in android app (searchview is not a part of action bar). I want to remove the space on the left side of the search icon/ searchview. I searched a lot and received answers which worked for searchviews which are part of action…
coolcoder
  • 309
  • 1
  • 3
  • 10
13
votes
4 answers

Android align text top center

I'm sorry if this is a duplicate but i couldn't find anything that was quite what I'm looking for. Basically, i want to align the text in the text View to be in the top center. And I would like to do this in XML if possible. So i want to…
user3810543
  • 425
  • 2
  • 4
  • 9
12
votes
3 answers

TextView setGravity() doesn't work in java

I'm stuck on a problem and I don't know, what causes it. I have a very simple Layout like this:
Rafael T
  • 15,401
  • 15
  • 83
  • 144
11
votes
7 answers

TextView gravity not working with Hebrew

I have TextView on Hebrew that i want to be on the right side, so i'm doing On some phones it will be aligned to right and on some it will be aligned to left. I think it depends on some phone…
Butters
  • 221
  • 2
  • 4
11
votes
9 answers

How do I apply gravity to my bouncing ball application?

I've written a fairly simple java application that allows you to drag your mouse and based on the length of the mouse drag you did, it will shoot a ball in that direction, bouncing off walls as it goes. Here is a quick screenshot: alt text…
anon
11
votes
2 answers

Android Spinner Gravity Not working

I'm trying for days to align the text in a spinner to right, but every time I fail to do it, I tried to set Gravity to right, or ellipsize to end but nothing works and all I have is this : can you please help with this issue ? Thanks a lot. Here's…
Houssem
  • 2,069
  • 3
  • 27
  • 42
10
votes
1 answer

Cocos2D Bezier curve around object as if by gravity

I'm trying to manipulate an object. When it gets near another object, let's say a globe, I want the globe to have a gravitational pull on the original object. I know I'm supposed to use CCBezierTo, so this isn't so much a programming question as it…
switz
  • 24,384
  • 25
  • 76
  • 101
10
votes
2 answers

How do I account for gravity using a wiimote's accelerometer?

For a project my team and I have been trying to track a wiimote in a 3D space using the built in accelerometer and the WiiMotion Plus gyroscope. We’ve been able to track the rotation and position using an ODE (Found at http://www.alglib.net/,) but…
Keith D Ball
  • 131
  • 7
1
2
3
55 56