Questions tagged [android-gravity]
60 questions
0
votes
0 answers
Why TableRow gravity will not affect child Views
From my understanding, a TableLayout is a LinearLayout with vertical orientation and a TableRow is a LinearLayout with horizontal orientation.
Since the TableLayout's children are TableRows whose layout_width is enforced to MATCH_PARENT, I can only…
![](../../users/profiles/3394898.webp)
user3394898
- 31
- 2
0
votes
0 answers
how to set condition on onCreate() and onResume() on Android?
I'm working on an android project based on a motion sensor. For various purposes, I'm using an accelerometer, the gyroscope in my project.
Here is a scippet of onCreate() on onResume() method:
protected void onCreate(Bundle savedInstanceState)
…
![](../../users/profiles/12328312.webp)
ferdous
- 21
- 4
0
votes
1 answer
Why Gravity.FILL_HORIZONTAL filling only half of the screen in Wear OS?
I have used Gravity.FILL and Gravity.FILL_HORIZONTAL to make a toast full screen.
But it's not working. It's only filling half of the screen horizontaly.
Toast.java
Toast myToast = Toast.makeText(this, "Clicked",…
![](../../users/profiles/8037846.webp)
miniature
- 42
- 6
0
votes
0 answers
Why Android Lint strictly discourages the use of Gravity.LEFT or Gravity.RIGHT?
I understand that texts may be LEFT or RIGHT on different languages, so that END or START may be useful for international apps.
However, LEFT or RIGHT as Gravity are also simple placement of things. If I want my button or icon to be aligned to the…
![](../../users/profiles/505152.webp)
htafoya
- 15,392
- 10
- 62
- 83
0
votes
2 answers
TextAlignment is not working dynamically for checkbox
Android.Views.Textalignment is not working dynamically
I have tried the below code:
In load time:
CheckBox checkBox = new CheckBox(this);
checkBox.TextAlignment = Android.Views.TextAlignment.ViewStart;
Dynamically change the alignment in a button…
![](../../users/profiles/10744138.webp)
geetha rajendran
- 41
- 5
0
votes
6 answers
How to center text inside TextView own container?
I need to create this :
As you can see the lines not exactly centered with the text .
The problem ever bigger with Lower case text .
the text is to low , not centered in is own view
this is my code - The container is Linear Layout with…
![](../../users/profiles/1951967.webp)
Jesus Dimrix
- 4,025
- 4
- 24
- 60
0
votes
1 answer
android:gravity="center" not working on Samsung with big font size
I've been having an issue with the vertical alignment of the text inside a button, but only on Samsung devices. The problem is that when I go to the settings and set the maximum font size (from normal to huge, so the size changes across all the…
![](../../users/profiles/4277741.webp)
Matvey Rybakov
- 660
- 1
- 12
- 19
0
votes
1 answer
How to detect Gravity of XML item
What is the correct way to detect the gravity flags used for an XML item? I'm trying to achieve the following:
If the gravity of my TableLayout (myTbl) is set to Gravity.TOP, then I want the gravity to be set to Gravity.CENTER_VERTICAL
Else if the…
![](../../users/profiles/3293579.webp)
SD826E
- 6,673
- 7
- 45
- 92
0
votes
3 answers
Horizontal LinearLayout inside Vertical LinearLayout
I want to display an horizontal linearlayout which content 3 imageview inside a vertical linearLayout
But i have a problem as you can see
Only the first Imageview is displayed , and he is in the center .
I changed the gravity for the other…
![](../../users/profiles/6276360.webp)
Kane Samba
- 259
- 1
- 4
- 15
0
votes
2 answers
gravity and layout:gravity properties not showing up in Android Studio 2.3
I have a LinearLayout inside of which I have a textView. When I click on textView in component tree I don't see it's gravity property in Properties menu on the right side. I also don't see layout:gravity property.
Even after manually adding those…
![](../../users/profiles/3362334.webp)
user3362334
- 1,441
- 1
- 15
- 36
0
votes
0 answers
Android - calculating device position
I'm currently in the process of creating an Android application that tracks templates using template matching, and then stores coordinates in a file. The next step is to also draw trajectories of this object. However, because the device is…
user3186023
0
votes
1 answer
Android layout gravity center horizontally
I have a problem with android:layout_gravity="center" in LinearLayout. I put text in the top and when I want to move it to the top center he moves it to the center of the phone and not to the up center.
![](../../users/profiles/7273309.webp)
Hanan Sabag
- 29
- 1
- 8
0
votes
1 answer
Listview item text gravity
I am using Arrayadapter with android.R.layout.simple_list_item_1 child
here is the getView function
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null)
convertView =…
![](../../users/profiles/3733774.webp)
Raafat Alhmidi
- 880
- 9
- 17
0
votes
1 answer
android How to set Gravity in RecyclerView
I'm trying to make a chat app, and having a trouble with setting gravity of custom view in the RecyclerView. I've been searching and trying a whole day, but i couldn't make, it always shows like this(ScreenShot).It should be located right of screen…
![](../../users/profiles/5786901.webp)
MWP
- 35
- 2
- 8
0
votes
1 answer
Display notifications correctly in Android Wear
My notifications display correctly when paired with an Android Wear square device - they are just sent to the device (watch) for automatic display to keep the code simple. However, they are in the default center of the screen on Wear round watches…
![](../../users/profiles/4334015.webp)
ChiralCode
- 31
- 1
- 6