Questions tagged [layout-gravity]

Android layout parameter that sets the gravity (alignment) of a View or Layout inside its parent container.

Standard gravity constant that a child supplies to its parent. Defines how the child view should be positioned, on both the X and Y axes, within its enclosing layout.

Must be one or more (separated by |) of the allowed constant values.

146 questions
0
votes
2 answers

Vertical LinearLayout gravity not working as spected

Im trying to set gravity="bottom" on a LinearLayout, so its children Views stack at the bottom. The problem is that when I check it on Eclipse it seems fine, but when I run in on the AVD it doesn't work. It just works as if gravity was set to…
Juan Bentel
  • 477
  • 2
  • 5
  • 15
0
votes
1 answer
0
votes
2 answers

How do I make TextView's text to the left in a one row with two TextView?

I would like to use a LinearLayout to position two TextViews' texts to the left in a single row . One TextView on the left hand side, the other on the right hand side. whole rows texts will be on the same line as vertically. Here is my XML:
0
votes
2 answers

Can't change the location of TextView's instance.

public class MainActivity extends Activity implements OnGestureListener { private LinearLayout mainlayout; private TextView tv; private GestureDetector gestureScanner; @Override public void onCreate(Bundle savedInstanceState) …
Kailani Yung
  • 45
  • 1
  • 8
0
votes
1 answer

Android top left button

I want to make an about button in the top left. I tried: android:layout_gravity:"top|left" but it doesn't work , I searched and all what I found was using RelativeLayout and if I use that I'll have to make all my layout from beginning and it's…
John Jared
  • 790
  • 3
  • 16
  • 40
-1
votes
2 answers

how to pad cursor in input field in Android

I have a cursor and hint that insists on being flush to the top left of an input field and I was wondering how I can fix this typically.
reactor
  • 1,722
  • 1
  • 14
  • 34
-1
votes
1 answer

Why layout_gravity not work for TextView?

As the title description, when set layout_gravity for TextView in LinearLayout, this property does not work well, and when I set it through LinearLayout.LayoutParams.gravity, it does not work as well. But for ImageView with same way, it works.
wqycsu
  • 290
  • 2
  • 16
-1
votes
1 answer

dynamically align layout_gravity right &top (or top&left)

I am a new programmer. I am trying to write a code that will dynamically change the layout gravity to top and right (or right and top) I did not understand how to change it to tight or left dynamically. LinearLayout.LayoutParams params = new…
michal
  • 17
  • 6
-1
votes
2 answers

Right gravity of textview in listview in android

I want to display data of emi calculation in listview, i am displaying it but the problem is it's gravity is not same for every textview in row, i mean i set gravity right for all but it's not looking in linear as in screenshot I want every…
Rajesh Panchal
  • 1,140
  • 3
  • 20
  • 39
-2
votes
1 answer

How can I remove effect of gravity using LayoutParams method in Android? (Gravity.NO_GRAVITY doesn't work.)

I have expected that TextView was aligned to the right because of NO_GRAVITY, however it was aligned to the left. Shouldn't NO_GRAVITY leave the gravity setting as it is, instead of aligning it to the left. If I also remove this two lines belove, it…
-19
votes
3 answers

Android center gravity is not working if container layout is in a scrollview

I am creating a ProgressBar to be placed in the vertical center of a LinearLayout (other layouts will not work; I need to use a LinearLayout). Here is some code: LinearLayout linearLayout = new LinearLayout(context); LinearLayout.LayoutParams…
dev
  • 11,071
  • 22
  • 74
  • 122
1 2 3
9
10